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 > regex question
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 10987 of 11065
Post > Topic >>

regex question

by davek@[EMAIL PROTECTED] (David Nicholas Kayal) Apr 24, 2008 at 09:47 AM

[dave@[EMAIL PROTECTED]
 quick_test]$ cat test_regex.pl
#!/usr/bin/perl -w

use strict;

my $line = "test_text";

if($line =~ m/^\d*/)
{
         print "true\n";
} else {
         print "false\n";
}

if($line =~ m/^\d/)
{
         print "true\n";
} else {
         print "false\n";
}
[dave@[EMAIL PROTECTED]
 quick_test]$ ./test_regex.pl
true
false
[dave@[EMAIL PROTECTED]
 quick_test]$

why is the first one true?




 3 Posts in Topic:
regex question
davek@[EMAIL PROTECTED]   2008-04-24 09:47:20 
Re: regex question
peng.kyo@[EMAIL PROTECTED  2008-04-25 17:07:32 
Re: regex question
davek@[EMAIL PROTECTED]   2008-04-25 14:16:42 

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 15:04:08 CDT 2008.