Regular expressions enable you to look for substrings that match a pattern, making them a powerful way to work with strings. For basic substring searches, you can use
String class methods such as
indexOf(). Methods such as
indexOf() work when you know the exact substring you want to find. For example, if you want to determine whether a string contains the substring
cog you can use the following code:
var string:String ...