Regular Expression and comma separated list

Hello -

I need a (perl based) regular expression that will allow me to search a comma separated list.

For example, I have the following list of numbers: 3225,4589,1245,8796

I need to detect whether 1245 is in the list using a regular expression.

Thanks,
DT
DTwinedAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
\b1245\b
0
 
HonorGodSoftware EngineerCommented:
I love it... An 8 character solution to a 500 point question.
0
 
point_pleasantCommented:
perl progname < list_name

while (<>)
{
        if ($_ =~ m/\b1245\b/ )
        {
                print "match";
        }
}
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.