#!/usr/bin/perl use strict; use warnings; use Regexp::Common; my $re = $RE{list}{-sep => '_'}{-pat => '(?:(?!_)\w)+'}; while (<DATA>) { chomp; print "'$_' ", /^$re$/ ? "matched\n" : "did not match\n"; } __DATA__ apple_pear apple_plum_grape _ apple _apple apple_ apple__pear 'apple_pear' matched 'apple_plum_grape' matched '_' did not match 'apple' did not match '_apple' did not match 'apple_' did not match 'apple__pear' did not match
Abigail
In reply to Re: ParseRecDescent and csv-like data
by Abigail-II
in thread ParseRecDescent and csv-like data
by rkg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |