[Chicago-talk] Help with regex

Richard Reina richard at rushlogistics.com
Sat Jan 20 12:40:58 PST 2024


Mike, Thanks for the quick reply but

perl -e 'my $em = "smagill\@abcco.com1/15/1998"; my $em =~ s/([\d\\])+$//; print "EMAIL: $em\n";'




gives me:

Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE [\d\\]+$/ at -e line 1.

Tried adding a ) after +$ but that just gives me an empty string for $em. Maybe I'm doing something wrong?



On Sat, 20 Jan 2024 14:28:52 -0600, Mike Raffety <MikeRaffety at earthlink.net> wrote:

s/([\d\\]+$//;

Richard Reina wrote on 1/20/2024 2:24 PM:
> Good day fellow perl mongers,
>
> I have a bunch of email addresses that have been corrupted with digits (mostly dates) stuck to the end. such as smagill at abcco.com12/19/1198 I am trying to figure out what kind of regex I can use to remove the numbers and recover the pure email address. I initially thought of something like
>
> $email =~ s/^\\D*\\d+//;
>
> but that didn't work and I quickly realized that even if it had it would fail if there were a digit in the email address.
>
> Any help would be greatly appreciated.
>
> Richard
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> https://mail.pm.org/mailman/listinfo/chicago-talk
 


More information about the Chicago-talk mailing list