livewirerules Posted March 19, 2010 Share Posted March 19, 2010 I need to match text that contain forward slashes /hello /test /MyWorks For eg: i want to match "/hello"? any help will be appreciated Quote Link to comment https://forums.phpfreaks.com/topic/195773-regex-slashes/ Share on other sites More sharing options...
The Little Guy Posted March 19, 2010 Share Posted March 19, 2010 This works: <?php $string = 'are you there? /test...'; if(preg_match("~/hello|/test|/MyWorks~", $string)) echo 'found word!'; else echo 'word not found'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/195773-regex-slashes/#findComment-1028450 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.