$1, $2 refers the capturing groups. $1 means first capturing group$2 means first capturing group…. etc.These are mainly used for replacement. Lets see an exampleWe…
We can explain our regular expression within the expression using comments. Syntax:(?#Commented Code) Suppose we have a two strings below:Hello worldhello World Regex to match…