Note that there are some explanatory texts on larger screens.

plurals
  1. PONSRegularexpression multiline and stack
    primarykey
    data
    text
    <p>I can't find a regular expression having balanced tags, one for opening and one for closing. Tags must enclose multi lines text; and tags are dynamic, not defined at compile time </p> <p>I can't match the closing tag corresponding to the opening tag, for instance {{home}} -> {{/home}} and {{hello}} -> {{/hello}}; it match {{home}} to {{/hello}} Any help will be greatly appreciated</p> <p>Any help will be greatly appreciated </p> <p>gregoire</p> <p>ps : I commented non working regexp </p> <pre><code> NSString * string; NSError* error = nil; NSRegularExpression* regex; NSArray* matches; string = @" The {{demo}}following tables describe the {{/demo}}character expressions" " used by the regular expression to match patterns within " " a string,{{home}} the pattern operators that specify how many" " times a pattern is matched and additional matching" " restrictions, and the last {{/home}}table specifies flags" " that can be included in the regular "; regex = [NSRegularExpression regularExpressionWithPattern: @"\\{\\{demo\\}\\}" "(.*)?" "\\{\\{(//|/demo)\\}\\}" options:NSRegularExpressionDotMatchesLineSeparators error:&amp;error]; // regex = [NSRegularExpression regularExpressionWithPattern: // @"\\{\\{.*\\}\\}" // "(.*)?" // "\\{\\{(//|/.*)\\}\\}" // options:NSRegularExpressionDotMatchesLineSeparators // error:&amp;error]; matches = [regex matchesInString:string options:NSRegularExpressionDotMatchesLineSeparators range:NSMakeRange(0, [string length])]; for ( NSTextCheckingResult* match in matches ) { NSLog(@"### %@ ###", [string substringWithRange:[match range]]); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload