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 Quote Link to comment 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 Quote Link to comment 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. 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.