in reply to Determing if this regex matched
Updated to match both begin and end.use strict; use warnings; my @items = ('"Title Text Example1"', 'Title Text Example2', ' Title T +ext Example3 ',' "Title Text Example4"'); foreach my $title (@items) { my $match = 0; $match++ if $title =~ s/^[\s"]+//; $match++ if $title =~ s/[\s"]+$//; print "$title.\n" if $match; } __END__ Title Text Example1. Title Text Example3. Title Text Example4.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Determing if this regex matched
by cormanaz (Deacon) on Aug 06, 2011 at 19:57 UTC | |
by ww (Archbishop) on Aug 06, 2011 at 20:06 UTC | |
by cormanaz (Deacon) on Aug 06, 2011 at 20:34 UTC | |
by AnomalousMonk (Archbishop) on Aug 07, 2011 at 10:22 UTC | |
by merlyn (Sage) on Aug 06, 2011 at 20:12 UTC | |
by cormanaz (Deacon) on Aug 06, 2011 at 20:30 UTC |