I’m trying to find and replace in notepad++ data from a json that has this pattern=
"(number, number)":
I know almost nothing about regex, but I know there is a solution.
>Solution :
I’ll attempt to run you through the process of getting this regex.
Step 1. In order to match a single digit you need \d.
Step 2. If you need to match more than one digit, you need to to encapsulate the digit symbol into squared brackets [\d], and add a quantifier. In this specific case, the quantifier + allows to get 1 or 1+ objects belonging to the elements inside the squared brackets, hence [\d]+ will match consecutive digits, hence a number.
Step 3. In order to match two numbers separated by a comma, you just need to replicate the regex we just created and separate them by a comma and a space [\d]+, [\d]+.
Step 4. We’re almost there. We just need parentheses. You can’t just add open and closed parentheses around: you need to escape them \(, \). This formatting is necessary because parentheses are symbols that belong to the regex syntax, so escaping them (putting the \ before them) will tell tell notepad++ that those parentheses are actual parentheses (characters) instead of regex syntax.
So, the final regex is the following:
"\([\d]+, [\d]+\)"
You can try matching every step to enhance your understanding of regex.