[thelist] Perl Regex Dummy needs help

Hassan Schroeder hassan at webtuitive.com
Mon Oct 20 10:35:40 CDT 2003


Luther, Ron wrote:

> How can I change the code below to get my $aa variable to output 
> whatever text appears between the "<BELNR>" and "</BELNR>" tags 
> in the XML file I am reading in?

> 		$aa = /<BELNR>($.)<\/BELNR>/; 

I think what you're looking for is:

	$aa = $1 if /<BELNR\>([^<]*)<\/BELNR>/;

Let me know if that doesn't work :-)

However -- are there no Perl XML modules? Seems like just getting
the value of an XPATH expression would be better (as in easier and
more precise) than regexing through it....

--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the thelist mailing list