Regex to match string containing two names in any order

后端 未结 8 1818
忘了有多久
忘了有多久 2020-11-22 05:15

I need logical AND in regex.

something like

jack AND james

agree with following strings

  • \'hi jack here is

相关标签:
8条回答
  • 2020-11-22 05:50

    Explanation of command that i am going to write:-

    . means any character, digit can come in place of .

    * means zero or more occurrences of thing written just previous to it.

    | means 'or'.

    So,

    james.*jack
    

    would search james , then any number of character until jack comes.

    Since you want either jack.*james or james.*jack

    Hence Command:

    jack.*james|james.*jack
    
    0 讨论(0)
  • Try:

    james.*jack
    

    If you want both at the same time, then or them:

    james.*jack|jack.*james
    
    0 讨论(0)
提交回复
热议问题