diff --git a/src/caoscrawler/transformer_functions.py b/src/caoscrawler/transformer_functions.py index 35da68f55d606d8200844023a407dc3b4e34cd25..6b2fa57d056bef43e8ea8574c6314c0155a1e5e5 100644 --- a/src/caoscrawler/transformer_functions.py +++ b/src/caoscrawler/transformer_functions.py @@ -27,9 +27,12 @@ import re from typing import Any -def ifelse(in_value: Any, in_parameters: dict): - """returns the first argument if it does NOT match the reg exp of 'match' stored in the second - argument, other wise the value of 'then' stored in the second argument is returned. +def submatch(in_value: Any, in_parameters: dict): + """ + Substitute the variable if it matches the regexp stored in "match". + + Returns the "in" value if it does NOT match the reg exp of 'match'. + Otherwise (if it matches) the value of 'then' stored in the second argument is returned. """ if "match" not in in_parameters or "then" not in in_parameters: raise RuntimeError("Mandatory parameters missing.")