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

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

Replies are listed 'Best First'.
Re^4: Regex to remove generic accounts
by AnomalousMonk (Archbishop) on Oct 28, 2008 at 12:12 UTC
    (?!pattern) is a negative look-ahead.

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

Re^4: Regex to remove generic accounts
by JavaFan (Canon) on Oct 28, 2008 at 07:58 UTC
    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>
        Yes, and no. Digits from other languages are matched by \d, but not every language. I think, but I haven't studied the Unicode property database in detail, that if the language uses a strict base-10 system, its digits are matched by \d. But the existance of a "tens" or "hundreds" symbol exclude all its digits from being matched by \d. And it may very well be that the database isn't consistent in this aspect. I don't know what system Japanese uses, but AFAIK, Kanji digits aren't matched by \d.