in reply to old Perl regex problem
I'm actually reading the pattern from a configuration file. Everything outside of the slashes is not changeable.
You have a misunderstanding about the meaning of [ ] inside a regular expression. [ ] is a character class, and matches exactly one character. Inside you either list the characters that are allowed to match, or the characters that aren't allowed to match. [^(H\-000)(IF\-000)] means the same as [^(H\-0)IF] and means "match a single character, the character could be anything, except a (, an H, a dash, a 0, a ), an I or an F.
If I understand your requirements, you are looking for all files that start with PH, and do not end with either "H-000" or "I-000". The following regex ought to work:
It works with 5.004_02./^PH(?:.{0,4}|.*(?![HI]-000).{5})$/
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: old Perl regex problem
by GhodMode (Pilgrim) on Aug 02, 2002 at 14:47 UTC | |
by Abigail-II (Bishop) on Aug 02, 2002 at 15:04 UTC | |
|
Re: Re: old Perl regex problem
by sauoq (Abbot) on Aug 02, 2002 at 19:06 UTC | |
by Abigail-II (Bishop) on Aug 05, 2002 at 10:01 UTC | |
|
Re: Re: old Perl regex problem
by GhodMode (Pilgrim) on Aug 02, 2002 at 16:17 UTC | |
by Abigail-II (Bishop) on Aug 05, 2002 at 09:59 UTC |