I am looking for a regex, that extracts everything after a given text (here, "HIT") until the next pipe symbol "|" which is NOT surrounded by "[[" and "]]".
Example-Text:
text | HIT = [[t1|t2]] moretext [[more braces]] | moretext | moretext
This is the regex I've tried:
HIT[ \t]*=(.[^\|]+)
Of course, this only returns "HIT = [[t1" but I am looking for a regex that returns "HIT = [[t开发者_如何学C1|t2]] moretext [[more braces]]".
Thanks for your kind support
Christian
Try this regular expression:
HIT[ \t]*=((?:[^[|]|\[\[[^[\]]*]])*)
The (?:[^[|]|\[\[[^[\]]*]])* part matches
- any sequence of either any character except [and|([^[|]), or
- a sequence of any character except [and]that is surrounded by[[…]](\[\[[^[\]]*]]).
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论