How to simulate regular expressions in LINQ-to-SQL

后端 未结 5 1612
生来不讨喜
生来不讨喜 2020-12-08 12:20

I have a database table with customer account numbers. Within the same table are test accounts that don\'t match the production formatting: say, \'A1111\' is production but

5条回答
  •  被撕碎了的回忆
    2020-12-08 12:40

    I changed the query to use the following in place of the Regex.IsMatch:

    where SqlMethods.Like(cust.Acct, ProductionMask)  
    

    where ProductionMask = "[bBgG][0-9][0-9][0-9][0-9]"

    the equivalent RegEx is: ^[B,G]\d{4}$

    If anyone sees that the 2 masks should not produce the same results, please let me know...

提交回复
热议问题