You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by Michael Mitiaguin <mi...@digerati.com.au> on 2001/10/29 01:23:14 UTC

Extracting node with all children

I am aware of XSLT or XML parser or  Omnimark   which probably suit better for that  , just
curious whether a single regular expressions is possible with ORO for :

<RuleList>
<Rule id=' something' name='rulename1'>
<RuleHeading>....</RuleHeading>
<RuleDescription>....</RuleDescription>
</Rule>
<Rule id=' something' name='rulename2'>
....
</Rule>
</RuleList>


I need to extract Rule with the name 'rulename1' from this buffer.

String regexpr = "<Rule\\s+.+rulename1"

works fine to identify the beginning

but

String regexpr = "<Rule\\s+.+rulename1.+</Rule>"

doesn't match anything.  Perl5Compiler.SINGLELINE_MASK  is used to include "\n".

So single ".+pattern"  works
but ".+pattern1.+pattern2"  doesn't

Though browsing archive  and applying 

String regexpr = "<GTRule\\s+id=[^\\s]+\\s+name='rulename1(.+?)</GTRule>" 

brought what I need 

still 

String regexpr = "<GTRule\\s+id=[^\\s]+\\s+name='rulename1.+</GTRule>" 

brought the whole buffer as match. No parenthesises and ? in second case.  


Thank you 
Michael