in reply to Help for regex
If you just need to do it once, and have data that is absolutely guaranteed to be well formed (so that the regex will be reliable) you can use something like this:
/<ID>(.*?)<\/ID>/
But if you have to do it regularly or on files where you can't guarantee that they'll be well formed, use an XML or HTML parser (e.g. XML::Parse or HTML::TokeParser). If it's not well formed XML, then an HTML parser is likely to be more forgiving.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help for regex
by Anonymous Monk on Apr 01, 2012 at 18:00 UTC |