![]() |
|
Just another Perl shrine | |
PerlMonks |
non-greedy piecewise matchingby mifflin (Curate) |
on Aug 02, 2007 at 16:50 UTC ( #630328=perlquestion: print w/replies, xml ) | Need Help?? |
mifflin has asked for the wisdom of the Perl Monks concerning the following question:
I have some data files that were created without newlines that need to be fixed. The files contain a bunch of records with an xml file name at the end. They look like... somedata file.xmlsomedata file.xmlsomedatafile.xml .... what I want them to be is ... somedata file.xml somedata file.xml somedata file.xml ... So , i thought I could use a piecewize regex like so... The problem is I cannot figure out how to make the regex non-greedy. My capturing portion matches the full string, all the way to the last xml file. How to I change the regex to be non-greedy and match up to the first xml file?
Back to
Seekers of Perl Wisdom
|
|