in reply to Re: Regex to remove generic accounts
in thread Regex to remove generic accounts

Is there any reason that you used [0-9] rather than \d?

I'm so adjective, I verb nouns!

chomp; # nom nom nom

Replies are listed 'Best First'.
Re^3: Regex to remove generic accounts
by Anonymous Monk on Oct 28, 2008 at 01:09 UTC
    That did the trick, thanks Monks!
    I will have to look up this ?! code. Is that part of atomic grouping?
    I prefer to use \d instead of [0-9] because it's less typing and special characters :). They are equivalent right?

    Thanks again,
    Ed
      (?!pattern) is a negative look-ahead.

      Take a look at the sub-section Look-Around Assertions in the section on Extended Patterns in perlre.

      They are certainly not equivalent. There are 10 characters that match /[0-9]/. The number of characters that match /\d/ varies from Perl version to Perl version. There are more than 100 characters that match /\d/ in 5.10, and that's only a proper subset of what is being matched in blead.
        There are more than 100 characters that match /\d/ in 5.10

        Does this mean that digits from other languages are also considered as 'digit' by \d? For example, if I have a string consisting of Japanese kanji, would \d match the Kanji digits too?

        -- 
        Ronald Fischer <ynnor@mm.st>