wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Need Help - XML Parsing - JDOM
Two questions on " JSP SYNTAX 1.2 " issued by SUN
XPath
XSLT string processing
Confused with Xpath expression! Need Help.