PHP preg_match to find whole words

后端 未结 2 2030
忘掉有多难
忘掉有多难 2020-11-28 09:26

I\'m quite new to regular expressions. Could you help me to create a pattern, which matches whole words, containing specific part? For example, if I have a text string \"Per

2条回答
  •  一向
    一向 (楼主)
    2020-11-28 10:13

    This matches 'Perform':

    \b(\w*form\w*)\b
    

    This matches 'expression':

    \b(\w*express\w*)\b
    

提交回复
热议问题