@ in regular expressions

C

Chris Sendall

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;
$_ = '(e-mail address removed)';
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
 
G

Gunnar Hjalmarsson

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

Am I correct in thinking this is a bug.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top