MCPcopy Create free account
hub / github.com/Squirrel/Squirrel.Windows / GetNestedBracketsPattern

Method GetNestedBracketsPattern

src/Squirrel/MarkdownSharp.cs:455–471  ·  view source on GitHub ↗

Reusable pattern to match balanced [brackets]. See Friedl's "Mastering Regular Expressions", 2nd Ed., pp. 328-331.

()

Source from the content-addressed store, hash-verified

453 /// "Mastering Regular Expressions", 2nd Ed., pp. 328-331.
454 /// </summary>
455 private static string GetNestedBracketsPattern()
456 {
457 // in other words [this] and [this[also]] and [this[also[too]]]
458 // up to _nestDepth
459 if (_nestedBracketsPattern == null)
460 _nestedBracketsPattern =
461 RepeatString(@"
462 (?> # Atomic matching
463 [^\[\]]+ # Anything other than brackets
464 |
465 \[
466 ", _nestDepth) + RepeatString(
467 @" \]
468 )*"
469 , _nestDepth);
470 return _nestedBracketsPattern;
471 }
472
473 private static string _nestedParensPattern;
474

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected