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)?$/