15 December 2023
unknown C10 - initial
count (Sifts) | |
---|---|
Type | Corrade progressive sift |
Sift | count |
Parameters | a CSV string representing a regular expression (regex) and regular expression options |
Description | The count sift will count the number of items in a list that match a supplied regular expression. |
Last Changes | None |
The count
sift will count the number of items in a list that match a supplied regular expression.
Name | Type | Description | Example |
---|---|---|---|
pattern | a string | a regular expression | [Ss]hoe |
options | a CSV of strings | regular expression engine options | IgnoreCase,Compiled |
The full list of regular expression options that can be passed is documented on the Microsoft website.
The following sift when added to a command will skip the first 2
items and then count the number of elements of the list that match the regular expression /[0-9]+?/
:
"sift", wasListToCSV([ "skip", 2, "count", wasURLEscape( wasKeyValueEncode( [ "pattern", "[0-9]", "options", wasListToCSV([ "IgnoreCase", "Compiled" ]) ] ) ) ]),
Given the input
data=a,1,c,2,e,3,h,4,h,5,j,7
the expected output is:
data=5