Does “\d” in regex mean a digit?

前端 未结 6 1306
天命终不由人
天命终不由人 2020-11-22 14:16

I found that in 123, \\d matches 1 and 3 but not 2. I was wondering if \\d matches a digit sati

6条回答
  •  臣服心动
    2020-11-22 14:40

    This is just a guess, but I think your editor actually matches every single digit — 1 2 3 — but only odd matches are highlighted, to distinguish it from the case when the whole 123 string is matched.

    Most regex consoles highlight contiguous matches with different colors, but due to the plugin settings, terminal limitations or for some other reason, only every other group might be highlighted in your case.

提交回复
热议问题