cryion has asked for the wisdom of the Perl Monks concerning the following question:
Hello. I'm having some issues with regex and Im not sure it is even possible to solve this using regex. But I have no way around using regex at the moment.
Imagine the following piece of xml:
(Xml is linarized and does not contain newlines)<xml> <info> <file>file:/path/to/some/file.mxf</file> </info> <info> <file>file:/path/to/some/file.xml</file> </info> </xml>
What I need to retrieve is the whole path to the xml file. The regex
file:(.*?\.xml)
does not work, because it matches the very first occurence of the file: string. Is there any way to do this, make regex ignore all the file: strings that are not part of the tag that actually includes the path to the xml file?
This is driving me nuts. Thank you!
Update: Corrected regex and added additional information for clarity.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex match: Ignoring first occurences
by Corion (Patriarch) on Aug 10, 2015 at 12:55 UTC | |
by cryion (Initiate) on Aug 10, 2015 at 14:17 UTC | |
|
Re: Regex match: Ignoring first occurences
by kcott (Archbishop) on Aug 10, 2015 at 13:29 UTC | |
by cryion (Initiate) on Aug 10, 2015 at 14:15 UTC | |
by GotToBTru (Prior) on Aug 10, 2015 at 15:26 UTC | |
|
Re: Regex match: Ignoring first occurrences
by Athanasius (Archbishop) on Aug 10, 2015 at 13:46 UTC | |
|
Re: Regex match: Ignoring first occurences
by Anonymous Monk on Aug 10, 2015 at 13:03 UTC |