From c91831a81722345ef7b4d20bd87c855903a7bca7 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 5 Sep 2021 22:59:46 -0400 Subject: Anki template regex helper updates (#1934) * Update regexReplace and regexMatch to support content arguments * Update documentation --- docs/templates.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/templates.md b/docs/templates.md index 1cc7e210..638c79a6 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -146,7 +146,8 @@ Uses a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScr
Syntax: - {{#regexReplace regex replacement [flags]}}text-to-modify{{/regexReplace}} + {{#regexReplace regex replacement [flags]}}text-to-modify{{/regexReplace}}
+ {{#regexReplace regex replacement [flags] [text-to-modify]...}}{{/regexReplace}}
* _`regex`_
The raw string used to create the regular expression. This value is passed to the [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) constructor. @@ -156,6 +157,7 @@ Uses a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScr Optional flags to pass to the [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) constructor. * _`text-to-modify`_
The text that the regular expression is applied to. + If multiple arguments are present, they are all concatenated.
Example: @@ -178,7 +180,8 @@ Uses a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScr
Syntax: - {{#regexMatch regex [flags]}}text-to-modify{{/regexMatch}} + {{#regexMatch regex [flags]}}text-to-modify{{/regexMatch}}
+ {{#regexMatch regex [flags] [text-to-modify]...}}{{/regexMatch}}
* _`regex`_
The raw string used to create the regular expression. This value is passed to the [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) constructor. @@ -186,6 +189,7 @@ Uses a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScr Optional flags to pass to the [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) constructor. * _`text-to-modify`_
The text that the regular expression is applied to. + If multiple arguments are present, they are all concatenated.
Example: -- cgit v1.2.3