Posted By

annalog on 11/17/09


Tagged

regex textmate


Versions (?)

Find highest level groups within recursive tokens


 / Published in: Other
 

  1. (?<!\)[(\[|\]|[^[]]|(?<!\)[.*(?<!\)])*(?<!\)]

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: annalog on November 17, 2009

This regular expression will find the highest level groups within recursive tokens. For instance, if I have "This is [just [an] example] of the [expression]", it'll find [just [an] example] and [expression], and nothing else. It will also not find an escaped bracket expression. If you want to replace the bracket with curly braces or parenthesis, be careful. As an example, curly braces will be: (?

Posted By: annalog on November 17, 2009

well that snippet didn't go in... maybe that way: (?<!\){(\{|\}|[^{}]|(?<!\){.(?<!\)})(?<!\)}

Posted By: annalog on November 17, 2009

well that snippet didn't go in... maybe that way: (?<!\){(\{|\}|[^{}]|(?<!\){.(?<!\)})(?<!\)}

You need to login to post a comment.