Page 2 of 2
Posted: Sun Aug 10, 2003 7:04 pm
by m3rajk
i started with them in depth witht e orielly learning perl book. used it more than any course i took. also explained it much much better. and they went from those pesky things everyone hates to something i don't mind
Posted: Mon Aug 11, 2003 10:07 am
by mikusan
nielsene wrote:
Your {3,4} stops it from matching all the two character country codes. It only matches the org/com/mil/net/info/coop/edu type top levels.
Well that's quite allright, i was fiddling with different types of domains...and that's not causing the problem thanks though... it's currently set {2,4} just in case, that is minimum 2 maximum 4.
In response to
m3rajk I am not sure but does your expression take in consideration [0-9] matches, i don't see a \d so i ask.
Basically all i am trying to do is what PHP bb already does though i would like to figure it out with your help and not exactly just copy n' paste.
My futile attempt to get it working is the following, but as you see it's very lengthy nad i have alot of stuff repeated. Plus it only recognizes links like:
me@myself.whatever after the'@' i would like it to recognize 3 things.
Code: Select all
$str = ereg_replace( "^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*.[0-9a-z]([-.]?[0-9a-z])*.[a-z]{2,4}$", "<a href="mailto:\\0">\\0</a>", $str );
Posted: Tue Aug 12, 2003 4:11 am
by Heavy
m3rajk wrote:... and \w is perl. perl is not local dependant.
But it is...
See
http://www.php.net/manual/en/pcre.pattern.syntax.php:
PHP Manual wrote: A "word" character is any letter or digit or the underscore character, that is, any character which can be part of a Perl "word". The definition of letters and digits is controlled by PCRE's character tables, and may vary if locale-specific matching is taking place (see "Locale support" above). For example, in the "fr" (French) locale, some char- acter codes greater than 128 are used for accented letters, and these are matched by \w.