<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>I want to extract the matched string into a variable.</DIV>
<DIV> </DIV>
<DIV>e.g.</DIV>
<DIV>my ($match) = something</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">Indy
Singh<BR>IndigoSTAR Software -- www.indigostar.com</DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=mattp@cpan.org
href="mailto:mattp@cpan.org">Matthew Phillips</A> </DIV>
<DIV><B>Sent:</B> Monday, April 29, 2013 11:14 AM</DIV>
<DIV><B>To:</B> <A title=indy@indigostar.com
href="mailto:indy@indigostar.com">Indy Singh</A> </DIV>
<DIV><B>Cc:</B> <A title=toronto-pm@pm.org
href="mailto:toronto-pm@pm.org">Toronto PerlMongers</A> </DIV>
<DIV><B>Subject:</B> Re: [tpm] String matching at start or middle or end of
list</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">Hi,<BR>Maybe
'if ('foo,bar,boo,baz' =~ /,?foo,?/) { ... } ' is what you're looking
for.<BR><BR>Cheers,<BR>Matt<BR><BR>
<DIV class=gmail_quote>On Mon, Apr 29, 2013 at 11:09 AM, Indy Singh <SPAN
dir=ltr><<A href="mailto:indy@indigostar.com"
target=_blank>indy@indigostar.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>Hi All,<BR><BR>What is a good way to match a string that may
appear at the start or middle or end of a list. I have stumbled along
and made this work in the past, now I am looking for the clean and proper way
to do it.<BR><BR><BR>Example:<BR>my $s = 'foo,bar,boo,baz';<BR>my ($match) =
$s =~ /(foo)/;<BR><BR>I am looking to match the following:<BR>The start of a
string or a separator followed by<BR>A specified string followed by<BR>A
separator or the end of the string<BR><BR>What are the extra things I need to
surround the match expression?<BR><BR>One of the unpleasant side effects of
putting a list with alternatives at the start .e.g. '(^|,)' , is that it
creates an undesired capture string. Is it possible to avoid creating the
capture string?<BR><BR>Indy Singh<BR>IndigoSTAR Software -- <A
href="http://www.indigostar.com"
target=_blank>www.indigostar.com</A><BR><BR>______________________________<U></U>_________________<BR>toronto-pm
mailing list<BR><A href="mailto:toronto-pm@pm.org"
target=_blank>toronto-pm@pm.org</A><BR><A
href="http://mail.pm.org/mailman/listinfo/toronto-pm"
target=_blank>http://mail.pm.org/mailman/<U></U>listinfo/toronto-pm</A><BR></BLOCKQUOTE></DIV>
<DIV> </DIV></DIV></DIV></DIV></BODY></HTML>