Friday, 15 July 2011

java - How to obtain a String between nested Tags -



java - How to obtain a String between nested Tags -

within project seek replace text within tags. seek string beanshell out of html file.

<code> var teststring = "<a href='test/keyword/common'>here our keyword should replaced</a><img src='test/keyword/again'/> </code>

now keyword between <code>a</code> tags should replaced. doable regex or substring or else?

in limited cases can regexps. i'd recommend html parsing/manipulation library such jsoup or jtidy. it'll give much more robust , (likely) more readable/comprehensible solution.

java beanshell

No comments:

Post a Comment