Regular Expressions

A regular expression (regex or regexp for short) is a special text string for describing a search pattern. You can think of regular expressions as wildcards on steroids. You are probably familiar with wildcard notations such as *.txt to find all text files in a file manager. The regex equivalent is ^.*\.txt$.

And here is an example in how to use them:

a second diagram of the same case with different explanations:

for more information: Link-1  —  Link2  —  Link3  —  MDN

Regular expression playground/testers:   —  —

Or you can use this link to go to another page with a complete cheat-sheet: LINK

This is an example that I use in one Kata:

In this blog post I keep the flavor or Regex to a JavaScript tone.

Now lest review some of the basics of RegEx:

  • Literal characters: a
  • MetaCharacters: wild card

Meta Characters:



To use a regular expression in a IF( … ) statement we can use the methods:

x.match( regex )    — String type

x.test( regex )   —  Method in the RegExp prototype.

and an example code would be:



Copyright 2017. All rights reserved.

Posted March 5, 2017 by Edmundo in category "Miscellaneous