in reply to how to do match www.jkghfdjbh.org from $li?
Have you read perlretut yet? You've got to get through some of that stuff if you want to move forward.
. is a special metacharacter inside of Perl regular expressions. It means to match anything except for newline.
Character classes match only a single character unless you add a quantifier.
Alternation is constrained to the entire regular expression, or the first enclosing ( ... ) or (?: ... ) construct.
Case insensitivity applies to character classes too.
Combine those issues, and what you have is:
m/ www # match literal 'www' . # match any single character except \n. [a-z] # match any single character between a and z. | # OR [A-Z] # match any single character between A and Z. . # match any single character except \n. [a-z] # match any single character between a and z. /ix # /i makes everything case-insensitive, so there's # no difference between [A-Z] and [a-z].
If you want to accomplish this without learning regular expressions, install the URI::Find distribution, and use its URI::Find::Schemeless module.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to do match www.jkghfdjbh.org from $li?
by AnomalousMonk (Archbishop) on Jun 11, 2013 at 11:18 UTC | |
by davido (Cardinal) on Jun 11, 2013 at 15:11 UTC | |
by hdb (Monsignor) on Jun 11, 2013 at 15:17 UTC | |
by davido (Cardinal) on Jun 11, 2013 at 15:22 UTC |