Regex to match whole word with a particular definition of a word

后端 未结 3 1395
故里飘歌
故里飘歌 2020-12-07 05:40

I am doing a file search and replace for occurrences of specific words in perl. I\'m not usually much of a perl or regex user. I have searched for other regex questions here

3条回答
  •  星月不相逢
    2020-12-07 06:24

    See the example on this page which explains boundary matchers

    Enter your regex: \bdog\b
    Enter input string to search: The dog plays in the yard.
    I found the text "dog" starting at index 4 and ending at index 7.
    
    Enter your regex: \bdog\b
    Enter input string to search: The doggie plays in the yard.
    No match found.
    

提交回复
热议问题