Master Regex Patterns
1 min readMay 17, 2020
understand syntax of regex patterns
Amazing blog to get started with:
https://www.rexegg.com/regex-quickstart.html
To search and replace a string with same string appended with some characters.
Put this regex ((.)+) in search box.
And in the replace box, put “$1”,
Example: Below is a file with following string
Node js
Java
C#
C++
Now you want to format this data into:
“Node js”,
“Java”,
“C#”,
“C++”
Replace multiple spaces by single space
Regex — \s\s+
Regex for matching an exact word
\b(go)\b
Ex: I wanted to match word go in my text.
Ex Javascript code:
let v = “dynamic value”;
let rgx = new RegExp(“\\b(“+v+”)\\b”,”gi”);