regex: creating an exception for r:a.?b.?c

后端 未结 2 1575
日久生厌
日久生厌 2021-01-22 15:13

I need to create a regex expression that will filter any variant of \"kitchen\" that has between 0 and 1 random characters between any of the letters, but it needs to make an ex

相关标签:
2条回答
  • 2021-01-22 15:43

    You can try using non consuming regex to make sure that "kitchen" is not covered by regex.

    (?=k.?i.?t.?c.?h.?e.?n)(?=^[kitchen])
    
    0 讨论(0)
  • 2021-01-22 15:45

    You can do a lookahead to make sure the string is not exactly 'kitchen'

    r:(?!kitchen)k.?i.?t.?c.?h.?e.?n
    

    DEMO

    0 讨论(0)
提交回复
热议问题