shedokan Posted November 27, 2007 Share Posted November 27, 2007 here is the line of the script: elseif(!preg_match("#^(http:\/\/www\.address\.com\//dir\//dir\//)+([a-zA-Z0-9])+(\.gif/)$#i" , $v1)) { and here's the error I get: Warning: preg_match() [function.preg-match]: Unknown modifier 'h' in bla...bla...bla... on line 258 thanks. Quote Link to comment Share on other sites More sharing options...
Orio Posted November 27, 2007 Share Posted November 27, 2007 No error on my server... (PHP 5.2.0) Try it this way tho, much cleaner: elseif(!preg_match("#^http:\/\/www\.address\.com\/dir\/dir\/[a-z0-9]+\.gif$#i" , $v1)){ Orio. Quote Link to comment Share on other sites More sharing options...
shedokan Posted November 27, 2007 Author Share Posted November 27, 2007 when I try to put this address it returns false: http://www.address.com/dir/dir/image.gif Quote Link to comment Share on other sites More sharing options...
veridicus Posted November 27, 2007 Share Posted November 27, 2007 Are the spaces within your regex string a forum quirk? If not, try removing the spaces. Quote Link to comment Share on other sites More sharing options...
Orio Posted November 27, 2007 Share Posted November 27, 2007 when I try to put this address it returns false: http://www.address.com/dir/dir/image.gif I get a match... Orio. Quote Link to comment Share on other sites More sharing options...
shedokan Posted November 27, 2007 Author Share Posted November 27, 2007 thanks. but I need that "_" are allowed and capitl letters too. Quote Link to comment Share on other sites More sharing options...
Orio Posted November 27, 2007 Share Posted November 27, 2007 Capital letters are allowed in th current version. And if you want to allow underscores, add an underscore into the square brackets. In overall, it should be: |^http:\/\/www\.address\.com\/dir\/dir\/[a-z0-9_]+\.gif$|i Orio. Quote Link to comment Share on other sites More sharing options...
shedokan Posted November 27, 2007 Author Share Posted November 27, 2007 Thanks!, and May I ask the last two things? 1, why did you replaced the # at the sart with |? 2, is it possible to do this with javascript? Quote Link to comment Share on other sites More sharing options...
Orio Posted November 27, 2007 Share Posted November 27, 2007 I don't like # hehe. No special reason. I don't know how to do that in javascript, but I am sure it's possible since javascript supports regex. Orio. Quote Link to comment Share on other sites More sharing options...
shedokan Posted November 27, 2007 Author Share Posted November 27, 2007 ow and forgot I need -'s too. thank Orio your'e the best. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.