Regex using word boundary but word ends with a . (period)

前端 未结 3 1634
走了就别回头了
走了就别回头了 2020-12-11 01:45

want to match word i.v. case insensitive

have pattern

(?i)\\bi\\.v\\.

but want a word boundary on the end
the abov

3条回答
  •  失恋的感觉
    2020-12-11 02:30

    About your current regex:

    You don't need to have \b after dot since dot is not considered a word character but of course dot needs to be escaped:

    (?i)\bi\.v\.
    

    But you do need \b before i to make sure it doesn't match e.g. hi

    EDIT: (Based on your further edits)

    Try this regex:

    (?i)\bi\.v\.(?=\s|$)
    

提交回复
热议问题