We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fd18e21 commit 6415b64Copy full SHA for 6415b64
adala/utils/parse.py
@@ -110,7 +110,10 @@ class TemplateChunks(TypedDict):
110
text: str
111
start: int
112
end: int
113
- type: str
+ type:
114
+
115
116
+match_fields_regex = re.compile(r"(?<!\{)\{([a-zA-Z0-9_]+)\}(?!})")
117
118
119
def parse_template(string, include_texts=True) -> List[TemplateChunks]:
@@ -135,7 +138,7 @@ def parse_template(string, include_texts=True) -> List[TemplateChunks]:
135
138
chunks: List[TemplateChunks] = []
136
139
last_index = 0
137
140
- for match in re.finditer(r"(?<!\{)\{(.*?)\}(?!})", string):
141
+ for match in match_fields_regex.finditer(string):
142
# for match in re.finditer(r'\{(.*?)\}', string):
143
# Text before field
144
if last_index < match.start() and include_texts:
0 commit comments