AI Cowboy has asked for the wisdom of the Perl Monks concerning the following question:
Say, for instance, this were to happen (a variable has a weird-ass value, and you try to parse an email address out of it). Why isn't the regex extracting the email address from this string? I can't find it out.$text = 'pilar@delphoss.com type add (#090930-230011-907000 ur22122021 + pi'; $text =~ s/.*\s(\w+)@(\w+)\.com .*/$1@$2\.(\w+)/;
EDIT: By the by, this code fragment is not what is used. The regex is used, but the variable is initialized through a large process in my code that I can't really release on here.
EDIT 2: Thanks to some of the help on this thread, I was able to get the proper regex, $text =~ /(\w+)@(\w+)\.com/;. Thanks to everyone for trying to help :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex being stupid
by davido (Cardinal) on Sep 19, 2013 at 03:06 UTC | |
|
Re: Regex being stupid
by Athanasius (Cardinal) on Sep 19, 2013 at 03:10 UTC | |
by AI Cowboy (Beadle) on Sep 19, 2013 at 03:20 UTC | |
|
Re: Regex being stupid
by CountZero (Bishop) on Sep 19, 2013 at 06:19 UTC | |
|
Re: Regex being stupid
by marinersk (Priest) on Sep 19, 2013 at 06:41 UTC | |
|
Re: Regex being stupid
by dave_the_m (Monsignor) on Sep 19, 2013 at 07:21 UTC | |
by Grimy (Pilgrim) on Sep 19, 2013 at 08:53 UTC | |
|
Re: Regex being stupid
by boftx (Deacon) on Sep 19, 2013 at 07:07 UTC | |
|
Re: Regex being stupid
by Laurent_R (Canon) on Sep 19, 2013 at 09:52 UTC |