Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > howto simplfy t...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 11023 of 11065
Post > Topic >>

howto simplfy this regex if ($string =~/^$match | $match | $match$/g){

by itshardtogetone@[EMAIL PROTECTED] May 4, 2008 at 01:19 PM

------=_NextPart_000_004C_01C8ADE9.8884D110
Content-Type: text/plain;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable

Hi,
How do I simplify the regex below so that it matches only the number 1, =
henceforth it should return false if I match $string with $match.

use strict;
use warnings;

my $string =3D "10 11 12 13 40";
my $match =3D 1;

if ($string =3D~/^$match | $match | $match$/g){
    print "match";
}else{
   print "unmatch";
};

------=_NextPart_000_004C_01C8ADE9.8884D110--




 5 Posts in Topic:
howto simplfy this regex if ($string =~/^$match | $match | $matc
itshardtogetone@[EMAIL PR  2008-05-04 13:19:50 
Re: howto simplfy this regex if ($string =~/^$match | $match | $
chas.owens@[EMAIL PROTECT  2008-05-04 01:29:02 
Re: howto simplfy this regex if ($string =~/^$match | $match | $
chas.owens@[EMAIL PROTECT  2008-05-04 01:47:28 
Re: howto simplfy this regex if ($string =~/^$match | $match | $
noreply@[EMAIL PROTECTED]  2008-05-04 08:05:48 
Re: howto simplfy this regex if ($string =~/^$match | $match | $
noreply@[EMAIL PROTECTED]  2008-05-04 07:45:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 14:56:48 CDT 2008.