A regexp r matches a string s if s is in the set of strings described by r .
Some regular expressions match only one string, i.e., the set they describe has only one member.
For example, the regular expression foo matches the string foo and no others. Other regular expressions match more than one string, i.e., the set they describe has more than one member. To either match or search for a regular expression with the Regex library functions, you must first compile it with a Regex pattern compiling function. A compiled pattern is a regular expression converted to the internal format used by the library functions. Once you've compiled a pattern, you can use it for matching or searching any number of times.