my $str='expire=0';
if ($str =~/expire\s*=\s* (?: 0[1-9]|[1-9][0-9])/){
print " found it ";
}
its not working
Condition expire= should be followed by a number between 1-99?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your regex has spaces, remove them:
Also the regex
0[1-9]|[1-9][0-9]does not match0.EDIT:
Based on your comments, you want to allow a number from
1-99afterexpire=so you can use:or a shorter version:
Since your example has
0afterexpire=it’ll not be matched.Also note that I’ve added the start and end anchors. Without them the regex may match any valid sub-string of the input. Example it can match
expire=99in the inputexpire=999