Regex: match word that ends with “Id”

后端 未结 6 1663
不知归路
不知归路 2020-12-01 05:52

I need help putting together a regex that will match word that ends with \"Id\" with case sensitive match.

6条回答
  •  甜味超标
    2020-12-01 06:58

    Gumbo gets my vote, however, the OP doesn't specify whether just "Id" is an allowable word, which means I'd make a minor modification:

    \w+Id\b
    

    1 or more word characters followed by "Id" and a breaking space. The [a-zA-Z] variants don't take into account non-English alphabetic characters. I might also use \s instead of \b as a space rather than a breaking space. It would depend if you need to wrap over multiple lines.

提交回复
热议问题