in reply to Help for regex
So it's impossible that a newline, whitespace, commas (or other significant delimiters), quotes, escape sequences, or other tags could be embedded in the ID? That being the case this seems simple enough:
if( $string =~ m/<ID>([^<]+)<\/ID>/ ) { print "$1\n"; }
It gets a lot more complicated if the input turns out to be more complex.
If you haven't done so already, please spend an hour with perlretut. After that you'll wonder why you needed to ask.
Update: Added a backslash. ;)
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help for regex
by Anonymous Monk on Apr 01, 2012 at 05:37 UTC | |
by davido (Cardinal) on Apr 01, 2012 at 05:50 UTC | |
by Anonymous Monk on Apr 01, 2012 at 05:41 UTC |