Skip to main content

New answers tagged

1 vote

Perl RegEx one-liner that outputs all matches from one line of STDIN

python would be much too verbose as a CLI one-liner For what it is worth, seeing the complex:er perl in @Stéphane's answer... # copy & paste the following lines into a shell to try it out echo '&...
Hannu's user avatar
  • 524
5 votes
Accepted

Perl RegEx one-liner that outputs all matches from one line of STDIN

echo '"this text", " ", "is in speech marks"' | perl -lne 'print for /"(.*?)"/g' Or: echo '"this text", " ", "is in speech marks&...
Stéphane Chazelas's user avatar
0 votes

How to make Perl half/full width-insensitive regular expressions?

What is the easy way to write /4|4/ ? Here's a long one-liner: perl -COA -lwe "@c=('A'..'C','x'..'z','0'..'9'); $rs = sprintf'[%s%s]', join('',@c), join('',map chr 0xfee0+ord, @c); print $rs; $r ...
Lumi's user avatar
  • 864

Top 50 recent answers are included