If you want to make sure there's (only) one space character after _each_ comma, use this:
Find field:
,[ \t]*
There is no need to precede the comma by \.
Replace field:
, _ (without the underscore)
This, in effect, will add a space character after each comma, while not (re-)placing any other white space, be it (a) space character(s) that were already there or even tab characters.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi folks. I am not sure if i need to use regex to do this. I am looking for a way to find for a comma sign which is not followed by space(s)
eg;
"menu_addblank(g_MainMenuID, 0,szMenuName,20)"
In this string, the first comma has space after it. So only the last 2 comma's will match
Please reply if you have any idea
Thanks
Thanks all!
I would use RegEx myself. I would use the find string:
\,[^ ]
comma followed by any character except a space.
Make sure the Regular Expression mode is selected otherwise it won't work.
Hey thanks that works! What about replacing those comma's with comma that has space?
"menu_addblank(g_MainMenuID, 0,szMenuName,20)"
to
"menu_addblank(g_MainMenuID, 0, szMenuName, 20)"
Find what: \,[^ ]
Replace with: ?
If you want to replace those commas WITHOUT a space with say an asterisk (*) then
Find: \,[^ ]
Replace With: *_ (where underscore represents a space)
If you want to delete the comma then
Find: \,[^ ]
Replace With: _ (where underscore represents a space)
This replaces the comma space with just a space.
If you want to make sure there's (only) one space character after _each_ comma, use this:
Find field:
,[ \t]*
There is no need to precede the comma by \.
Replace field:
, _ (without the underscore)
This, in effect, will add a space character after each comma, while not (re-)placing any other white space, be it (a) space character(s) that were already there or even tab characters.
Oops, I only saw half the question.
The answer is:
Find: \,([^ ])
Replace with: , \1 (comma, space, backslash one)
We'll have a description of regular expression operators in the Wiki shortly.