[Question] How can I search for a specific word?
Closed this issue · 2 comments
EdZava commented
How can I search for a specific word?
example of the code I want to change
NewTest; // This is what I want to change
raise ENewTest.Create; // I don't want this line to change
My config
"replacerules.rules": {
"find": {
"find": "NewTest",
"replace": "raise ENewTest.Create",
"literal": true
}
}
but it changes all the sites not only the word.
Outcome
raise ENewTest.Create;
raise Eraise ENewTest.Create.Create;
As you can see, it hardly changes the search for the exact word.
how could i do it?
bhughes339 commented
Hi,
Enclose the word you are looking for with the word boundary token \b
and remove the literal
flag:
"replacerules.rules": {
"find": {
"find": "\\bNewTest\\b",
"replace": "raise ENewTest.Create"
}
}
EdZava commented
It worked perfectly.
Thank you!