Daniel Mueller wrote:
> 
> hi group!

Hello,

> i'm currently trying to match all variables in a file, the regex i use looks
> like this :
> 
> m/([\$|\@|\%]\w+)/g
> 
> it matches as far as i can see what i want but it also matches stuff like
> this :
> 
> |SOMETEXT
> 
> why is this? what am i doing wrong?

A character class is different than a regular expression.  A character
class specifies a list of characters of which you only want to match
one.  Your list includes the characters '$', '|', '@' and '%'.  Your
match should be written as:

m/([EMAIL PROTECTED])/g

Note that '|', '@' and '%' have no special meaning inside a character
class, just the '$', '^' and '-' characters have.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to