C
cayenne
Hello all,
I'm a perl noob...and just can't quite figure out how to do something
that should be pretty simple.
Here's an example.
I have $mail_address = 'fred jones <[email protected]>'
I want to use regular expressions to just parse out the userid here of
fred_jones
I'm trying things like this:
$mail_address =~ /\w+@/;
But, doesn't seem to work. I'm a little hazy on exactly how the =~
works...through examples I've successfully used it for substitutions
like x =~ s/tom/joe/g; but, I'm just wanting to match a regular
expression and extract it to the variable...or even to another
variable leaving $mail_address unchanged.
I've looked in books at the substr() function, but, I don't know how
to use regular expressions to find the offset point, etc.
Can someone give me an example...or pointers to a good reference on
this type of thing?
Thanks in advance,
chilecayenne
I'm a perl noob...and just can't quite figure out how to do something
that should be pretty simple.
Here's an example.
I have $mail_address = 'fred jones <[email protected]>'
I want to use regular expressions to just parse out the userid here of
fred_jones
I'm trying things like this:
$mail_address =~ /\w+@/;
But, doesn't seem to work. I'm a little hazy on exactly how the =~
works...through examples I've successfully used it for substitutions
like x =~ s/tom/joe/g; but, I'm just wanting to match a regular
expression and extract it to the variable...or even to another
variable leaving $mail_address unchanged.
I've looked in books at the substr() function, but, I don't know how
to use regular expressions to find the offset point, etc.
Can someone give me an example...or pointers to a good reference on
this type of thing?
Thanks in advance,
chilecayenne