Answer the question
In order to leave comments, you need to log in
How to replace a group of characters with one in the same amount?
There are strings of the form
927 0000000 927 0199999
901 8020000 901 8039999
902 2900000 902 2999999
902 3200000 902 3249999
902 3350000 902 3399999
...... It
is necessary to change the groups of zeros and nine to% to be changed
, in the first line you need 927 %%%%%%%% % 927 01%%%%%
I sort of figured out how to find such groups: (\d)\1{4,7}
Can be used not only under notepad++
Answer the question
In order to leave comments, you need to log in
In python it can be done like this
>>> a
'927 0000000 927 0199999'
>>> re.sub('\d{7}', lambda x: '%'*len(x.group()), a)
'927 %%%%%%% 927 %%%%%%%'
>>>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question