|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
DoT Smarty n00b
Joined: 28 Mar 2004 Posts: 4
|
Posted: Fri Apr 02, 2004 8:57 pm Post subject: preg_match problem |
|
|
Hi,
i am parsing a $_REQUEST Var through the function preg_match
[php:1:cc3ca2f277]
$url = $_REQUEST['url'];
if(!preg_match("/[a-z]:\/\//si", $url)) $url = "http://$url";[/php:1:cc3ca2f277]
if i am giving a index.php?url=site.com it makes http://site.com ... ok
but if i try index.pgp?url=http://site.com it makes http://http:/site.com <- error
the pref_match w/o smarty works fine *g* |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Apr 02, 2004 10:38 pm Post subject: |
|
|
I don't think it working or not has anything to do with Smarty. This regex may be slightly more appropriate for you:
It anchors its search to the start of the subject ($url) and insists that the protocol is 3 or 4 (lowercase english letters) long. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|