@ in regular expressions

Discussion in 'Perl Misc' started by Chris Sendall, Jun 24, 2005.

  1. 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;
    $_ = '';
    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
    Chris Sendall, Jun 24, 2005
    #1
    1. Advertising

  2. Chris Sendall wrote:
    >
    > [\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 @-.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Jun 24, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jay Douglas

    Custom Regular Expressions in ASP.net

    Jay Douglas, Nov 2, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    600
    mikeb
    Nov 3, 2003
  2. mark

    Regular expressions

    mark, Jun 30, 2003, in forum: Perl
    Replies:
    4
    Views:
    1,714
  3. Dustin D.
    Replies:
    1
    Views:
    11,148
  4. Jay Douglas
    Replies:
    0
    Views:
    593
    Jay Douglas
    Aug 15, 2003
  5. Noman Shapiro
    Replies:
    0
    Views:
    222
    Noman Shapiro
    Jul 17, 2013
Loading...

Share This Page