reK()

What does reK() do?

reK() allows for the use of regex. K specifies what regex action will be done. The first parameter inside is the Regular Expression and the second inside parameter is the string to look through.

K can take the form of the main array operators ("_", "@", "#") and will check whether the expression is found, where the expression is found, or how many times it was found. You can use the actual operator or a string with it in it.

from ArrayExpressions import arrex
lst = ["hat", "cat", "mat", "pan", "trap", "bat"]
output = arrex.evaluate(lst, 'e(re{_}("at", x))')
print(output) # [True, True, True, False, False, True]

Other Important Information:

InputA regex expression (string), comma, string to search
Does it create a new scope?No
OutputWill either output the count, if a value exists, or the index of where the value first appears
KThe info from the regex search: # for count, @ for index, _ for existence. K can be the operator or a string literal
IThe same index
Examplere#(".all", "Y'all ball and we fall")
Example ExplanationThis will count how many times the regular expression '.all' pops up, which is 3. ('all, ball, and fall)

srt()