regex - How to use regular expression in Notepad++ to insert comma in sequence of space and digit -


i trying insert delimiters in text file. in 1 case, want insert comma before digit. can uniquely specify points want insert comma in each row space , digit. briefy, data looks follows:

row1 data etc etc 1234 row2 data etc 825 row3 data etc 719 

and on. note there bunch of various characters, , @ end of line there space , digit of sort. want use regular expression specify pattern of digit space, , replace space, comma, digit. so:

row1 data etc etc ,1234 row2 data etc ,825 row3 data etc ,719 

i believe have come find field:"\s[0-9]"

however, don't know put in replace field. tried "\s,[0-9]", literally replaces regular expression string "\s,[0-9]". how go having generically leaving space , digit, , putting in comma?

i appreciate advice can provide. thanks.

you should use capturing groups in search pattern , replace backrefenreces these groups (and comma) so:

search: (\s)(\d)

replace: $1,$2

you might want change search pattern (\s)(\d+)$ if there chance encounter numbers before wanted position. $ used anchor end of line.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -