P is for Practical | |
PerlMonks |
(shockme) Re: Regex for IP and Optional Portby shockme (Chaplain) |
on Jan 16, 2002 at 02:10 UTC ( [id://139054]=note: print w/replies, xml ) | Need Help?? |
Thanks for the insight, everyone. After studying andye's and dmmiller2k's suggestions, I was able to come up with a somewhat functioning framework. It was tye's comment that really brought it all home, though. \w does not include spaces, but it does include numbers. Doh! (Upon reflection, my example input data file is a very poor example, indeed.) The solution lied in constructing a character class of [\s\Wa-zA-Z]+.
For completeness' sake, following is the final regex:
Thanks again! Update: Fiddled with the grammer. If things get any worse, I'll have to ask you to stop helping me.
In Section
Seekers of Perl Wisdom
|
|