RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Pattern Title
Expression
(?<!\\)\[(\\\[|\\\]|[^\[\]]|(?<!\\)\[.*(?<!\\)\])*(?<!\\)\]
Description
This regular expression will find the highest level groups within recursive tokens. For instance, if I have &quot;This is [just [an] example] of the [expression]&quot;, 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: (?&lt;!\\)\{(\\\{|\\\}|[^\{\}]|(?&lt;!\\)\{.*(?&lt;!\\)\})*(?&lt;!\\)\}
Matches
[just] | [just [an] example]
Non-Matches
\[just]
Author Rating: The rating for this expression. Joaquin Jares
   Displaying page 1 of 1 pages; Items 1 to 1

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials