Why \b does not match word using .net regex

后端 未结 2 506
情歌与酒
情歌与酒 2020-11-27 23:24

To review regular expresions I read this tutorial. Anyways that tutorial mentions that \\b matches a word boundary (between \\w and \\W characters). That tutori

2条回答
  •  醉话见心
    2020-11-28 00:20

    You should use @"\bCOMPILATION UNIT". This is a verbatim literal. When you do "\b" instead, it parses \b into a special character. You can also do "\\b", whose double backslash is parsed into a real backslash, but it's generally easier to just use verbatims when dealing with regex.

提交回复
热议问题