A regular expression is a pattern or template for string matching. Regular expressions are written with a very specialized, powerful syntax which can perform complex string comparisons, extract desired substrings, or perform advanced search and replace operations on strings.
PBL provides support for regular expressions using syntax compatible with Perl regular expression syntax.
/{regular expression}/
/hello/
A regular expression is a pattern which is written to match single characters or multiple characters. In the case above, each one of the characters in /hello/ is simply matching itself. The next simplest matching character is the dot ".", which will match any single character except newline "\n". For example, the expression /c.t/ will match "cat", "cut", or any other three-character string starting with c and ending with t, so long as the middle character is not a newline.
/c[au]t/
Many other characters and expressions are possible. They are described in various topics throughout this section.
'/{regular expression}/'
myString.contains('/Hello/')
This line of code will search for the word "Hello" in the string that is contained in myString. It returns true if "Hello" is found and false if it is not.
"Hello world!".contains('/Hello/')
returns true because "Hello world!" does contain "Hello".