TruthVoyager
7 years agoNew Contributor
Using RegExp with aqString.Contains
I am trying to check to see if a string contains any letters using the following code.
if(aqString.Contains(info[i], /[A-Za-z]/) != -1) { an = "a"; }
This if returns false even when it should return true. Any idea what is wrong?
Thank you,
Also, both "contains" and "find" don't support regular expressions. The second parameter is the literal "sub-string" that you're searching for, not a regular expression. This is why you're getting a false every time. If you want to determine if a string contains another string based upon regular expression, you should use aqString.StrMatches (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqstring/strmatches.html)