Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私たちが持っている場合:
$text = 'Jame is sleeping but pretend that is "studying"';
今、私はregex後にすべての単語を取得する必要がありますisが、二重引用符または一重引用符で囲まれていない場合。
regex
is
結果は正しいはずであり、そうでsleepingはありませんstudying。
sleeping
studying
これは実際には非常に簡単です。
is\s(\w+)
あなたはそれをもう少しリベラルにすることができます:
is\s([^\s"']+)
これを試して:
is (\w+)
実例