I use this script for practicing regex:
#!/usr/bin/env perl use strict; use warnings; use 5.014; my $string; my $pattern; while ( ( say "Input template string:" ) && ( $string = <> ) ) { while ( ( say "Input pattern:" ) && ( $pattern = <STDIN> ) ) { chomp $pattern; my $regex = qr/$pattern/p; $string =~ $regex; say "${^PREMATCH} \x{25a0}\x{25a0}${^MATCH}\x{25a0}\x{25a0} ${ +^POSTMATCH}"; } }
In reply to Regex practice script by kindlychung
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |