in reply to Re: RegEx to find the index of the character '@' in an Email address
in thread RegEx to find the index of the character '@' in an Email address

Regular expressions are not strings
Right, but numbers aren't strings either.

Remember, this is Perl. If you use a string as a regexp, Perl will treat it as a regexp.

my ($local_part) = $mail =~ '^([^@]*)';
works just fine.
  • Comment on Re^2: RegEx to find the index of the character '@' in an Email address
  • Download Code

Replies are listed 'Best First'.
Re^3: RegEx to find the index of the character '@' in an Email address
by Corion (Patriarch) on Jul 26, 2010 at 16:05 UTC

    Sure, but if you use double quoted strings, you forego the convenience of Perl knowing that you mean to write a single backslash when you want a backslash to appear in the regular expression.