简体   繁体   中英

how to search all words starts match with regular expression character in php?

I have to search all words from a string with regular expression character in php. i am using preg_match_all('/\\b.*?\\b/i', $string, $matchWords) ;

but it search all words character in the different position.

eg suppose string is "India is my country". I have to search i

It should result "India" and "is". Please help me

这可以通过/(?<!\\w)i\\w+/ regx 来完成它会起作用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM