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 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'; ?> Link to comment https://forums.phpfreaks.com/topic/195773-regex-slashes/#findComment-1028450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.