Answer the question
In order to leave comments, you need to log in
Regular expression replacement in notepad++
there is a huge php array file, encoding UTF-8 without BOM, notepad++ 5.9 unicode
content like this:
$locale = Array(
'yes' => 'Yes',
'no' => 'No'
…
);
the task is to replace all words in Cyrillic in quotes with the same thing, but with a prefix
it would seem that everything is simple, ideally for a one-word phrase it would be enough to
replace '([a-zA-Z]+)' with 'prefix \ 1'
but such a replacement works out for 10% of _coincidences_, no matter how I racked my brains, I can’t achieve a result, I completed the task itself manually, now it’s just interesting to find a solution.
at the same time, if you search by [a-zA-Z] +
selects the whole word, then the floor of the word, then one letter
Answer the question
In order to leave comments, you need to log in
“At the same time, if you search by [a-zA-Z] + selects either a whole word, or a half of a word, or one letter”
A special. do the start (^) and end ($) characters of the string not help?
This is clearly some kind of bug in the regular expression engine. By the way, I just played around with substitutions on a completely different example, and for some reason, even such a regular expression does not find anything in the English text: ([az][az])+. I wanted her to look for words with an even number of letters.
Use TextPad. Regular expressions are more powerful in it (even multiline expressions work). And there are no such bugs.
I just checked it myself - and in truth, the processing of regular expressions behaves strangely.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question