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.
正規表現を使用して文字列から文字列の一部を見つけようとしていますが、
たとえば、私の文字列は次のとおりです。
string = "Hello my name is carl how are you doing?";
そして、「carl」という名前を一致させたいのですが、どうすればそれを行うことができますか?
これは私が持っているものです、
.*?(?=\show)
私の問題は、「こんにちは私の名前は」というテキストと一致しません
乾杯
カール
試してみてください\w+(?=\show):
\w+(?=\show)
> var string = "Hello my name is carl how are you doing?"; > /\w+(?=\show)/.exec(string) ["carl"]
var m = myStr.match(/(\w+) how are you doing\?/) if (m) { name = m[1]; }