|
|
| Just another Perl shrine | |
| PerlMonks |
Is there a better way to write this RegEx?by theAcolyte (Pilgrim) |
| on Apr 20, 2004 at 08:47 UTC ( [id://346609]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.theAcolyte has asked for the wisdom of the Perl Monks concerning the following question:
Bonjour! (feeling international today)
I've got a regEx which is working fine, but it seems, somehow, inelegant. I've been pouring through documentation to find a better way to write this, but I haven't come up with anything yet. While I've wrapped my mind around the basics, I'm always striving to get better, so I thought I'd ask: is there a better way to do this? Here is the (single line) I'm matching against:
And here is my regEx:
$1 captures everything which is the actual error, in this examples case "File does not exist .... " to the end. I had thought there must be a way to say "match the very last ] you find, til the end of the line, but I haven't been able to figure it out. Just seems wasteful to me to have to match all that client 102.102.102.102 stuff to grab the part I actually want. So, anyone care to enlighten me on the more elegant solution? Eagerly awaiting your Monkish reponses ... theAcolyte
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||