visual studio code - Using capturing parentheses and "not in" together in a useful regex search/replace? -


i search , replace part of number in csv file not include entries searched sting preceded comma (see picture below). want drop "30" each of numbers highlighted green circle not "30" highlighted red circle when using replace all.

i've tried ,30[0-9](.+) , ,30[^,](.+) search string don't know how include [0-9] or [^,] in replace field. best come replace term ,$1 replaces "1" in ",30102," produce ",02," instead of need, ",102,".

is there can add the replace term include missing character or there more elegant method this?

enter image description here

you want remove 30 preceded , , followed digit.

use

,30(\d) 

and replace ,$1. see regex demo.

the (\d) capture digit group 1 , $1 restore in result.

if want remove 30 after comma , before word char (to include cases 30 followed _, digits or letters), use

,30\b 

and replace mere ,. see another regex demo.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -