Eggzorcist Posted September 14, 2008 Share Posted September 14, 2008 Hello, How could I find a word in a directory? if my text was: hello/this/is/a/nice/burger.php How with regex could I find burger in this? Thanks Link to comment https://forums.phpfreaks.com/topic/124133-simple-regex-question/ Share on other sites More sharing options...
Psycho Posted September 14, 2008 Share Posted September 14, 2008 No need to use regex in that situation, just use strpos(): http://www.php.net/manual/en/function.strpos.php Link to comment https://forums.phpfreaks.com/topic/124133-simple-regex-question/#findComment-640894 Share on other sites More sharing options...
genericnumber1 Posted September 14, 2008 Share Posted September 14, 2008 if your application does not work for strpos() (which I can think of many, and you didn't give us enough info to be able to tell whether strpos() will work for you) the regex %/([A-Za-z0-9\-_]+)\.php% would work, along with whatever regex function you would use for what you're trying to do. You didn't give enough info for us to tell you what function to use. Link to comment https://forums.phpfreaks.com/topic/124133-simple-regex-question/#findComment-640910 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.