For example:
$ perl -pe 's/(.)\G/{$1}/g'
abcd
and the result is:
{}{a}{b}{c}{d}
the first period(.) match is zero length. Is this a bug or a feature?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For me the result is “abcd”, because
/(.)\G/gcan never match — how can it match a single character before the current position, starting at the current position?s/\G(.)/{$1}/gon “abcd” produces “{a}{b}{c}{d}”, which is expected.