I pasted your regex into my script exactly and it didn't work either :(. I found one that did, though.
     First, I want to make sure I understand yours. Please tell me if the following is correct...
/^PH(?:.{0,4}|.*(?![HI]-000).{5})$/
- starts with PH
- (?:)these parentheses aren't memory parentheses
- followed by 0 to 4 of any character or zero or more of any character
- (?!)return true if "H-000" or "I-000" would not match next
- followed by 5 of any character
- followed by the end of the line
     At first, I thought it failed because of the
.{5} part. So, I changed it to
{4,5} because the possibilities are "?H-000" (only 4 characters after the H) or "I?-000". That still didn't work. I was confused about why you used the (?:) and the quantifier and the or after the first wildcard dot, so I removed them. It still didn't work.
     After all that I re-started. I counted the characters between the PH and the part I wanted to check (\d{19}) and tried
/^PH\d{19}[^I][^H]-000$/. It's a little easier because all of these files have a fixed format. That did work, but I wasn't sure I needed to quantify the characters between the PH and the end of the file name. So, I ended up with
/^PH.*[^I][^H]-000$/ which works fine.
     I'm not sure why I couldn't get yours to work. I haven't used regex extensions or assertions before, so I want to understand them better.
Many thanks for your input.
Invulnerable. Unlimited XP. Unlimited Votes. I must be...
        
GhodMode