I have seen this one-line perl code from the web when I searched Google "perl remove comma from numbers":
perl -pe 's/(?<=\d),(?=\d)//g' file
I don't understand ?<=
and ?=
I understand that ()
is for grouping and capturing; (?:)
is without capture; and s///
is to substitute, and g
is to apply globally, and \d
is digit; my own code is s/(\d),(\d)/$1$2/g
Can someone please tell me ?<=
and ?=
I cannot find explanation of this perl expression on the web.
Thank you very much!