Regular expression

Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems.

Regular expression are terribly awkward, their syntax can sometime look super human, but are powerful tools in one’s arsenal of processing strings with immense precision and accuracy.

Regular expression are other types of object in JavaScript. They can be constructed in two ways, wither with the Object constructor RegExp, or with literal /

Regular expression exposes a list of methods to work with, the simplest of them all is the test method that simply tells whether a string contains a given patter

  console.log(/abc/.test("abcde"));//true

Regular expression allow us to express more complicated patters, it offers few ways you can represent ranges (\d : any digit, \w: any alpha numeric character etc…)

You can group patters, use matchers and much more coming from regular expressions. Regular expressions are powerful tools that will take almost anyone time to master, but once you do master them, you basically have mastered the string theory ;)