F
F
Fastto2011-06-17 18:48:37
Regular Expressions
Fastto, 2011-06-17 18:48:37

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

7 answer(s)
@
@message, 2011-06-17
_

Well, I seem to have succeeded, try this regular routine ...

A
Alexander, 2011-06-17
@Palehin

“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?

S
Shedal, 2011-06-17
@Shedal

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.

M
max_rip, 2011-06-17
@max_rip

'([a-zA-Z ])+?'

N
Nikita, 2011-06-17
@Nigrimmist

I just checked it myself - and in truth, the processing of regular expressions behaves strangely.

W
whynot, 2011-06-18
@whynot

It works fine for me on sublimeText. So, for information that npp is no longer the coolest and most convenient

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question