text:
で始まる大括弧内のテキストのキャプチャで現在動作している正規表現/^\[(text:\s*.+?\s*)\]/mi
があります。ここではそれが動作する例です。正規表現でいくつかの例外を除いて括弧内のテキストを検索するにはどうすればよいですか?
[text: here is my text that is
captured within the brackets.]
さて、私はそれが下の場合と同様に、特定のブラケットができますように例外を追加したいと思います:
[text: here is my text that is
captured within the brackets
and also include ![](/some/path)]
は基本的に、私はそれができるようにする必要があります括弧内の括弧は![](/some/path)
です。
ご協力いただければ幸いです。ありがとう。
アップデート:ここで
括弧内のテキストが一致しなければならないいくつかのケースされています
[text: here is my text that is
captured within the brackets
and also include ![](/some/path)]
[text: here is my text that is
captured within the brackets
and also include ![](/some/path) and some more text]
[text: ![](/some/path)]
![text: cat]
ここでは、それが一致していなければならないいくつかの例です:
[text: here is my text that is
captured within the brackets
and also include ![invalid syntax](/some/path)]
[text: here is my text that is
captured within the brackets
and also include ![] (/some/path)]
[text: here is my text that is
captured within the brackets
and also include ! [](/some/path)]
[text: here is my text that is
captured within the brackets
and also include ! [] (/some/path)]
これらの角かっこを特別なものにして、一致させる必要がありますか?それはその前の '!'ですか?それらが対応する開閉括弧であることは事実ですか?それらの括弧はより深くネストすることができますか? –
正規表現の味は? –
使用している[regex](https://en.m.wikipedia.org/wiki/Comparison_of_regular_expression_engines)の「味」を知る必要があります。 – binarysubstrate