gpt4 book ai didi

regex - 正则表达式 : Match a string not immediately preceded by or followed by a alphanumeric character

转载 作者:行者123 更新时间:2023-12-05 09:22:19 26 4
gpt4 key购买 nike

搜索d时

例如

  • "D" = true
  • “D” = true
  • “D” = true
  • [D!” = true
  • “广告!” = false
  • “悲伤” = false
  • "sa d!ness" = true

最佳答案

您可以使用环视:

(?<![A-Za-z0-9])[Dd](?![A-Za-z0-9])

这意味着匹配 dD 之前或之后没有 [A-Za-z0-9]

RegEx Demo

关于regex - 正则表达式 : Match a string not immediately preceded by or followed by a alphanumeric character,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27879341/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com