#!/usr/bin/perl
$mystring = "[2004/04/13] The date of this article.";
if($mystring =~ m/(\d+)/) {
print "The first number is $1.";
}
Perl returns 2004, but Kiki and Kodos return /04/. Why that?
Perl returns |
||||
|
|
|
Since you did not provide your Python code (or whatever Kiki and Kodos are) then it can be hard to say for sure but my guess is that the pattern syntax for Kiki and Kodos differs from Perl in that you do not need the forward-slash delimiters. For example the equivalent in Python would be:
Notice that the pattern does not include forward-slashes. |
|||
|
|
In Perl it's important to realize that the regex operator isn't The following are all equivalent:
|
||||
|