aspose file tools*
The moose likes Java in General and the fly likes how to extract tag from java by expression. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to extract tag from java by expression." Watch "how to extract tag from java by expression." New topic
Author

how to extract tag from java by expression.

John McDonald
Ranch Hand

Joined: Jul 01, 2003
Posts: 112
Hello,
I would like to use token to extract <B>bold</B> to three simple tokens. Any idea how to define this expression in StringTokenizer, please? Thanks and much appreciate.

John
Barry Higgins
Ranch Hand

Joined: Jun 05, 2003
Posts: 89
<B> bold </B>

(<*> (*)(</*>

You can then reference each token using the group function in Matcher.
eg.

Mathcher m=Pattern.compile("(<*> (*)(</*> ").matcher(stringForParsing);
for (int i=0; i<=m.groupCount(); i++)
System.out.println(m.group(i));

Hope that helps,
Barry
Barry Higgins
Ranch Hand

Joined: Jun 05, 2003
Posts: 89
The smiley faces went in there automatically that expression should look like
"(<*>)(*)(</*>)"
I hope it came out OK this time
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to extract tag from java by expression.
 
Similar Threads
Two questions on " JSP SYNTAX 1.2 " issued by SUN
Confused with Xpath expression! Need Help.
Need Help - XML Parsing - JDOM
XSLT string processing
XPath