Regex to match string containing two names in any order

后端 未结 8 2090
忘了有多久
忘了有多久 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
    

提交回复
热议问题