[Lexer] Prevent the regex from being greedy

This commit is contained in:
Kyle Fuller
2014-10-25 15:12:20 +01:00
parent 57ae44d167
commit d71e0ec012
2 changed files with 10 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ import Foundation
public struct Lexer {
public let templateString:String
let regex = NSRegularExpression(pattern: "(\\{\\{.*\\}\\}|\\{%.*%\\}|\\{#.*#\\})", options: nil, error: nil)
let regex = NSRegularExpression(pattern: "(\\{\\{.*?\\}\\}|\\{%.*?%\\}|\\{#.*?#\\})", options: nil, error: nil)
public init(templateString:String) {
self.templateString = templateString