description |
---|
Use regular expressions with WOQL and JavaScript. |
WOQL provides Pearl Compatible Regular Expressions (PCRE) using the predicate regexp
with the structure:
regexp(pattern, string, match_list)
Examples of basic regular expression pattern matching with WOQL.
Match a string to pattern "t(..)t"
.
regexp("t(..)t", "test", ["v:All", "v:Match"])
Results
v:All | v:Match |
---|---|
"test" |
"es" |
Match a string to pattern "m..h"
.
regexp("m...h", "this is a match of a string", ["v:All"])
Results
v:All |
---|
"match" |
Match start ^
and end $
of a string to pattern "^m...h$"
.
regexp("^m...h$", "this is a match of a string", ["v:All"])
regexp("^m...h$", "match", ["v:All"])
Results
v:All |
---|
(no match) |
"match" |
Match start and end of the string to pattern "^(....)-(..)-(..)$"
.
regexp("^(....)-(..)-(..)$", "2020-10-12", ["v:All", "v:Year", "v:Month", "v:Day"])
Results
v:All | v:Year | v:Month | v:Day |
---|---|---|---|
"2020-10-12" |
"2020" |
"10" |
"12" |