laziness, impatience, and hubris | |
PerlMonks |
Re: Regex hackeryby markkawika (Monk) |
on Jun 12, 2009 at 18:33 UTC ( [id://771051]=note: print w/replies, xml ) | Need Help?? |
That regex isn't too bad. Your assumption about : not being allowed in a filename is completely wrong. About the only character not allowed in a filename is a directory separator, such as / on Unix. But apart from that, I have a few minor suggestions on your regex.
Rewritten, it would read: After this, your file name is $1, and your size is, as you stated, $2$3. And yes, there is an ambiguity, where if the line was:
The regex would parse "go" as the file name and "2123.45" as the file size. There's no way around this given the format of the input.
In Section
Seekers of Perl Wisdom
|
|