
Laurent_R
Veteran
/ Moderator
Sep 18, 2015, 2:42 AM
Post #4 of 4
(12848 views)
|
Re: [tot94] "qr/\d+.+\.pdf$/ );" what mean ?
[In reply to]
|
Can't Post
|
|
qr/.../ is the quote operator for regular expressions. It basically says: I am not passing an ordinary string, but a regex, and it says to the compiler to compile it as a regex. In qr/\d+.+\.pdf$/ ), the first dot is a meta-character that will match any character (except a newline) and will do it any number of times (as any times as possible) because of the + quantifier that follows. The second dot is preceded by a backslash (the escape character), meaning that "\." is meant to match a literal dot ".". And yes, this expression could catch a file like : 2a.pdf, or 2aa.pdf, 2abc.pdf, 3abdcef.pdf, etc.
|