@ in regular expressions

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Recent upgrade to linux server (and move to perl 5.8.0) seem to have
broken regexp recognition of a string of text to be an e-mail address

This test program demonstrates the problem

#!/usr/bin/perl -w
use strict;
$_ = 'cjs2@cam.ac.uk';
print "text is $_\n";
print "Matches /^[\w .\@-]+$/ \n" if /^[\w.@-]+$/;
print "Matches /^[\w .\\@-]+$/ \n" if /^[\w.\@-]+$/;

[\w.@-] used to work now I need to add \ before @

Am I correct in thinking this is a bug.

Chris Sendall

Re: @ in regular expressions

Chris Sendall wrote:
Quoted text here. Click to load it

No. Please study "perldoc perlvar" and read about the variables @+ and @-.

Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Site Timeline