Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/yamlp.git

Revised example regexes

AuthorDave Jarvis <email>
Date2019-07-04 14:53:19 GMT-0700
Commitf1a147f1fda6fc12c1b402242b4d7abe84c07d1b
Parentcc78f87
README.md
The regular expression syntax allows a variety of syntaxes to be used when matching variable name references, such as:
-* `(\\${(.*?)})` - matches `${...}`
-* `({{(.*?)}})` - matches `{{...}}`
+* `(\$(.*?)\$)` - matches `$...$`
+* `(\$\{(.*?)\})` - matches `${...}`
The open and closing parentheses---`(` and `)`---are mandatory. The `?` indicates a non-greedy match. Without the `?`, multiple variable references would not match. For example, `name: $var.1$ $var.2$` would be treated as a variable named `var.1$ $var.2` instead of two distinct variables `var.1` and `var.2`.
+
+Wrap the regular expression in single quotes when running the command, such as:
+
+ java -jar $HOME/bin/yamlp.jar --regex '(\$(.*?)\$)' < variables.yaml
+ java -jar $HOME/bin/yamlp.jar --regex '(\$\{(.*?)\})' < variables.yaml
+
+
+The single quote prevents the shell from expanding the regex argument into a list of file names.
# Errors
variables.yaml
-
Delta10 lines added, 3 lines removed, 7-line increase