RegExp for matching three letters, but not text “BUY”

前端 未结 2 1202
你的背包
你的背包 2021-02-05 01:36

I have two buttons on form, one of the buttons contain currency code (EUR, USD, GBP,CHF,..) and another one - trade direction (BUY or SELL). And some utility recognize buttons b

相关标签:
2条回答
  • 2021-02-05 01:48

    You can use a negative look-behind assertion to verify that the text just matched does not equal BUY.

    [A-Z]{3}(?<!BUY)
    
    0 讨论(0)
  • 2021-02-05 02:04
    ^(?!BUY)[A-Z]{3}$
    

    (?!BUY) is negative lookahead that would fail if it matches the regex BUY

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