in reply to Re: Checking for occurrence in comma separated string
in thread Checking for occurrence in comma separated string
This is not a very good regexp but it's only an example. I suggest to read more about regular expressions, then start asking question about the difficult parts not the standards covered in almost every regex tutorial.$thestring = "15,130,213"; if ($thestring =~ /(^13,)|(,13,)|(,13$)/) { print "13 is in $thestring +"; } else { print "13 is not in $thestring"; }
|
---|