Using C# Regex
Simple Input: [testA].[max] [testB]
Match: [testB]
Input: 5/ [test1] [test2].[max] [test3] *2 [min]
Match:[test1] [test3] [min]
I want to match anything with like [Whatever] but not match [Whatever].[(min|max|mean|sum|median)]
This works sort of it does not match [min] on its own.
(?!\[((\w|[.])+)\]\.\[(min|max|mean|sum|median)\])\[((?!min|max|mean|sum|median).+?)\]
How about
(?<!\.)\[[A-Za-z0-9]*\](?!\.\[.*\])
(?<!\\.)
- Negative lookbehind to prevent .[max]
matching matching as well. \\[[A-Za-z0-9]*\\]
- Match [...]
, add other characters if necessary. (?!\\.\\[.*\\])
- Negative lookahead to ignore [...].[...]
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.