Posts

Showing posts from October, 2016

A pristine Pattern Matching method in Javascript

Whenever it comes to Pattern matching developers have almost always sought JS functions as they provide an easy way to perform pattern matching ranging from numeral and alphanumeric strings to algebraic functions. So though, I'm here to elucidate a more sleek way in which pattern matching can be done in modern JavaScript, I feel that it's crucial to state the predecessor(...maybe not yet!) pattern matching method, that is Regex. Regex Pattern Matching The most common and rudimentary method followed world-wide is the Regex Reference. Regex, that is Regular Expressions, are applied on a character string to check for the existence of a specified pattern. Regex also provides a "match and modify" functionality, to coin the term. What this means is that we can search for a particular pattern and perform replacement, split, sub-string extractions,etc.  at the same time.
The following syntax illustrates the base structure of any regex.
          /pattern/modifiers;
So for exa…