ABC、DEF, GHI, JKL、MNO
PQR、STU, VWX、YZ
How do I replace all ,
s with 、
in the repeated pattern above?
The repeated pattern can be mapped with the regex below:
"^\\([A-Z]+、\\)\\(\\([A-Z]+\\), \\)+"
However, because the ,
is a subset of group \\2
, even though it can be separated from its preceding letters in the regex,
there is no way to replace it using replace-regexp
without some form of nested group code. Also, DEF,
doesn't seem the match like GHI,
and STU,
with the regex.
(replace-regexp "^\\([A-Z]+、\\)\\(\\([A-Z]+\\), \\)+" "\\1\\2、")
What's the right way to do this, then?
Update:
@jue's answer below resulted in this: