Regular expressions: Ensuring b doesn't come between a and c

前端 未结 4 1223
无人共我
无人共我 2020-11-22 15:26

Here\'s something I\'m trying to do with regular expressions, and I can\'t figure out how. I have a big file, and strings abc, 123 and xyz

4条回答
  •  情书的邮戳
    2020-11-22 16:16

    The comment by hvd is quite appropriate, and this just provides an example. In SQL, for instance, I think it would be clearer to do:

    where val like 'abc%123%xyz' and
          val not like 'abc%abc%' and
          val not like '%xyz%xyz'
    

    I imagine something quite similar is simple to do in other environments.

提交回复
热议问题