Ask a Question

Using RegExp with aqString.Contains

New 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, 

Champion Level 3

According to this


"contains" is obsolete


"find" is the replacement


See if that works for you.


ETA:  This looks like a better option


and here is TC information on regular expressions

Esteemed Contributor

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 (

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

^^ Great minds think alike @tristaanogre   Man Tongue

Thank you very much!




Showing results for 
Search instead for 
Did you mean: