I agree with the earlier comments that you should just use computer name as lowercase contains "sql"
.
That said, a little explanation on how your regex appears to parse to me -
regex "[SQL*]+(\d+)+[A-Za-z]+(\d+)
[SQL*]+
The characaters “S”, “Q”, “L”, or “*”, at least one occurrence.
-> Lowercase “s”,“q”, or “l” do not match.
-> Does not require all three characters, or their order, so any “S” such as “SEC” would also match
(\d+)+ - at least one digit, up to any number of digits. The two “+” are redundant.
[A-za-z]+ - at least one alpha character, up to any number of alpha characters
(\d+) - at least one digit, up to any number of digits
So, “cstfmrdevsqlb04” fails in several ways -
- The “sql” is not uppercase
- The “sql” is not followed by a digit, then an alpha, then another digit (it’s followed by the “b” character, with a digit after)
A computername that matches the regex would be something like
q: exists matches (regex "[SQL*]+(\d+)+[A-Za-z]+(\d+)") of "cstfmrdevSQL04b1"
A: True
If you wanted to only have the condition “must contain SQL” that is much more easily done as in the other comments, but a Regex to match would be something like one of the following:
q: exists matches (regex "[Ss][Qq][Ll]") of "cstfmrdevsqlb04"
A: True
T: 0.110 ms
q: exists matches (case insensitive regex "SQL") of "cstfmrdevsqlb04"
A: True
T: 0.122 ms
The first is for exactly one of “S” or “s”, followed by exactly one of “Q” or “q”, followed by exactly one of “L” or “l”. The second switches to “case insenstive regex” to just look for “SQL” in order, upper- or lower-case.