Post History
Perl 5's /x modifier ignores whitespace in the regex, but it doesn't seem to ignore whitespace in the replacement (and I don't know enough perl to fix this). However, if you want to match whitespac...
Answer
#1: Initial revision
Perl 5's `/x` modifier ignores whitespace in the regex, but it doesn't seem to ignore whitespace in the replacement (and I don't know enough perl to fix this). However, if you want to match whitespace, it will have to be escaped. See the [perlre§/x and /xx](https://perldoc.perl.org/perlre#/x-and-/xx). ``` perl -pe ' s/ \$to\ =\ ".*";$ /\$to = example\@example.com; /xg ' PATH ``` [Try it online!](https://tio.run/##qyrO@J@anJGvoK5Skq9gq6CUnF@uZK2uYKcQ4Bji8b8gtShHQbcgVUGdSwEIivXBlIJCDFB1jIJtjIKSnpaStQpEVD8GYkZqRWJuQU5qjAOUoZecn2sNVVKRzqUOMfo/AA "Zsh – Try It Online")