regex - Regular expression find and replace one char to another only in searched phrase -


i want find text beetwen tags , replace in find

one char one

example before:

432-543-432432value="4aa32-5aa43-432432" 432-543-432432value="432-532-4324-44" 432-543-432432value="2064-43-4-0" 432-543-432432value="643-42-423-52" 432-543-432432value="6-435-4-35-3453" 432-543-432432value="4-32-43-634-53" 

after:

432-543-432432value="4aa32zz5aa43zz432432" 432-543-432432value="432zz532zz4324zz44" 432-543-432432value="2064zz43zz4zz0" 432-543-432432value="643zz42zz423zz52" 432-543-432432value="6zz435zz4zz35zz3453" 432-543-432432value="4zz32zz43zz634zz53" 

so want replace "-" "zz" after value=" , next "

is there way in notepad++ or other text editor

edge situations:

432-543-432432value="---5aa43--432432" 432-543-432432value="---5aa,,43--4324,,32" 432-543-432432value="abc" 432-543-432432value="--abc" 432-543-432432value="--abc--" 432-543-432432value="--" 

you can go 2 ways here:

match every - not followed more 1 ". works fine cases, problematic if there can sequences " in desired part (something value="he-re\"thiswontwork")

`-(?!(?:[^\n"]*"){2})` 

using negative lookahead.

the other approach navigate desired part of string , series of replacements in there using continuous matching \g

(?:value="|\g(?!^))[^-\n]*\k- 

this matches either value=" or position last match took place, series of characters neither - nor linebreak. resets match , matches -

in both cases replacement zz or whatever want use.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -