Reputation: 3907
i want to search matching word in string like if i have a string
"i'm expert in ..."
"i have exposure "
if i search "exp" i should return "expert" from first string and "exposure" from second string, if i search "exper" than i should just return "expert" or other words starting "exper"
i'm not looking for position of word but return searched word with in string
i have looked for this all i found strstr(),strrpos() and some others but not what i'm looking for and i'm unable to get it working
Upvotes: 0
Views: 117
Reputation: 7778
Very similar to enrico:
/(exp\w+)/gi
here http://regex101.com/r/xO9eR7/1
Upvotes: 0
Reputation: 31494
You can find all the words starting with exp
using pre_match
or preg_match_all
and the regex:
/(exp\w*)/g
You can test it here.
Upvotes: 2