I'm trying to remove commas from a certain place within a text file. The input looks like this:
Y=6","~2807-1 Q12m. Plate(s), screw(s), rod(s) or pin(s) in any bone - NO"
I only want to remove the commas between the "Y=6","" and the ending double quote. If I use
(?<=Y=\d",").*(?=")
I can isolate the part between those but can't for the life of me figure out how to just get the commas.
1 Answer
- Find:
(?:Y=\d","|\G)[^,"]*\K, - Replace:
NOTHING
Explanation:
(?: # start non capture group Y=\d # literally Y= followed by 1 digit. You may want to use \d+ for 1 or more digits "," # literally "," | # OR \G # restart form last match position
) # end group
[^,"]* # 0 or more any character that is not comma or double quote
\K # forget all we have seen until this position
, # a comma