I'm trying to make a regular expression that change all common incorrect comma formating to a correct one in a text file - don't want to find correct comma formating.
Finds a comma that has at least one space before and any after (edited: changed * to +, typo):
/ +, */
Finds a comma that do not have any space after:
/,(?! )(?!\n)/
Finds a comma that has more than one space after:
/, +/
Combination:
/ +, *|,(?! )(?!\n)|, +/
In addition I don't want it to match text stings at all. A code that uses a sting that have " or ' before and after:
"," "hjsdh,hjj,jhj"
',' 'asjj,'
How to make a combo of these?
The find should be replaced by a correct comma (a comma and a space).
Examples of incorrect comma formating:
#,#
# ,#
#, #
# , #