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.
次を返す正規表現を(JavaScriptで)作成したいと思います。
それは可能ですか?
次の方法で実行できます。
/(?=(test))(test-a)?/
testとaを実際に探しているパターンに置き換えます。
test
a
固定することもできます。たとえば、次のようになります。
/^(?=(test))(?=(test-a)?)test(?:-a)?$/