Duration: 15 minutes
Summary: In this video we start our discussion of regular expressions.
Regular expressions are coded patterns that can be used to search for matching
patterns in strings. We start by creating a string and a regular expression to
test for. We used the test() method for that purpose. We showed couple of ways
to create the regular expression: first using the RegExp() constructor, second
using the // and the pattern exists inside the forward slashes. We also used
the ‘i’ after the last slash to signify ‘ignore case’. In the second example,
we created a function to match a specific pattern, but in this case using ‘g’
and a while loop to do a global search and find all the matches in the string.
Finally, we added a new function br() to add a break to the screen instead of
always writing ‘document.writeln(“
Methodology of the development of example: Good coding standard and simplified design.