Hello Jose,
You need to add a backslash before all escape characters that are not an regex pattern as well as slashes.
In your case I assume the "default" HTML attribute path looks something like this
/HTML[1]/BODY[1]/DIV[1]/DIV[5].
To match exactly this HTML attribute path you need to but a backslash infront of the characters /[] :
/HTML
[1
]/BODY
[1
]/DIV
[1
]/DIV
[5
] → \/HTML
\[1
\]\/BODY
\[1
\]\/DIV
\[1
\]\/DIV
\[5
\]
From here you can replace the value of the first DIV element with your character class and its quantifier
[0-9]+:
\/HTML\[1\]\/BODY\[1\]\/DIV\[
[0-9]+\]\/DIV\[5\]
Note that you should not use backslashes for the character class's brackets or the quantifier.
I would suggest to narrow down the possible matches as much as possible, as the regex pattern
[0-9]+, will match a number 1 or more times. This means it could match e.g.
/HTML[1]/BODY[1]/DIV[100000]/DIV[5].
If you know that the value of the DIV element ranges between 0 and 99, you could replace
[0-9]+ with
[0-9]{1,2}.
Another thing you could try to narrow down the matches is to add anchors at the beginning and the end of your HTML Path like this:
^\/HTML\[1\]\/BODY\[1\]\/DIV\[[0-9]{1,2}\]\/DIV\[5\]
$This way you should avoid matching your HTML path in another HTML path, that has your HTML path as a substring.
Here are links to the .NET documentation regarding regex quantifiers and anchors:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressionshttps://docs.microsoft.com/en-us/dotnet/standard/base-types/anchors-in-regular-expressionsHope this helps!
Kind regards,
Ivan
------------------------------
Ivan Khudur
------------------------------