in reply to reg exp

m/[\d]{5,8}|[:alpha:]{3}[-]{1}[:alpha:]{4}/g

I think you should use [[:alpha:]], not [:alpha:]. I'm not sure, though

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

Replies are listed 'Best First'.
Re: Re: reg exp
by diotalevi (Canon) on Sep 30, 2002 at 12:57 UTC

    No you got that right. Be unsure no longer. The named POSIX classes are nice for keeping things clear especially when you consider character sets and Unicode. [A-Za-z0-9_] is sufficient for US-ASCII but it's wordy and easier to mistype than [:alphanum:]. The nice thing is that if you start moving beyond US-ASCII then you've already taken care of some of th work up front. It's also more in line with what I gather will be the expected idiom for perl6. The idea here is that it is infeasable for you to actually specify what is a "word" character for whatever character set you're using in your regular expression.