简体   繁体   中英

Get characters which are not in brackets REGEX

I'm basically working on custom query building. I've designed the pattern as field_set and sub_field_sets. A sample Query:

({e:3}.{f:44}.{f:2}) + ( 
                   ({e:3}.{f:44}.{f:3}) + ({e:3}.{f:44}.{f:4}) 
                        ) - ({e:3}.{f:44}.{f:5})

I want to get all operators from root using REGEX. Which in this case should result ['+', '-'] and NOT ['+', '+', '-']

这适用于给定的样本:

([+-])(?![^+)-]+\)\s*\))

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM