Regex: match word that ends with “Id”

后端 未结 6 1657
不知归路
不知归路 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:33

    I would use
    \b[A-Za-z]*Id\b
    The \b matches the beginning and end of a word i.e. space, tab or newline, or the beginning or end of a string.

    The [A-Za-z] will match any letter, and the * means that 0+ get matched. Finally there is the Id.

    Note that this will match words that have capital letters in the middle such as 'teStId'.

    I use http://www.regular-expressions.info/ for regex reference

提交回复
热议问题