`regex{n,}?` == `regex{n}`?

后端 未结 7 1857
灰色年华
灰色年华 2021-01-20 15:06

-edit- NOTE the ? at the end of .{2,}?

I found out you can write

.{2,}?

Isnt that exactly the same as bel

7条回答
  •  一向
    一向 (楼主)
    2021-01-20 15:29

    x.{2,}?x matches "xasdfx" in "xasdfxbx" but x.{2}x does not match at all.

    Without the trailing ?, the first one will match the whole string.

提交回复
热议问题