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. Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/ 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. Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400110 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 Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400285 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. Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400299 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. Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400308 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. Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400414 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. Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400458 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? Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400602 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. Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400613 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. Link to comment https://forums.phpfreaks.com/topic/79032-solved-help-preg-match-error/#findComment-400634 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.