Regex: match word that ends with “Id”

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

    Regex ids = new Regex(@"\w*Id\b", RegexOptions.None);
    

    \b means "word break" and \w means any word character. So \w*Id\b means "{stuff}Id". By not including RegexOptions.IgnoreCase, it will be case sensitive.

提交回复
热议问题