This correctly matches when the script name is:
HTxxx
xxHTxxx
And other combinations. It ALSO matches for ANY name that includes a capital “H”. It does NOT match a lower case “h”, even when combined with a “t”. It does NOT match an upper case “T”, unless there is ALSO an upper case “H” in the name. I need it to match uppercase HT only (as well as the “CAS” test, but that one seems to work for the most part). What am I missing in the REGEX test?
Ah. Sorry. I was left with the impression that “HT” is not matched, and you wanted to include it in the match.
Well then… If you don’t want to match “H” only, then what you’re missing is a “.” in front of the second “*”, i.e. the regex should be “.HT.”.
That would match any string that contains the substring “HT”, including just the string “HT” itself, but would not match the strings “H” or “T”.
The “*” affects the character before it, and having it in front of “T” meant that you’re accepting zero or more “T” characters, not a zero or more of any character, which is what the “.” is.
Actually, come to think of it, because the pattern is not anchored in any way, you may as well just use “HT” as a pattern, i.e. make that line
Basically, unless the pattern starts with “^”, it’s as if you have an implied “." at the start, and unless the pattern ends with “$”, it’s as if you have an implied ".” at the end.