As @brookter rightly points out, you are searching for regular expression (‘regex’) special characters. “But,” you might say, “I didn’t know”. Indeed, but nor does action code parser! Anything you type as an input in .contains()
and .icontains()
should be treated as if it were regex code (which is easily looked up online if unclear.
So, why did code that used to work not work now? Tinderbox is over twenty years old; old by software standards. What is possible now, wasn’t possible then so the parsable outcomes of action code then were narrower than now. In 2001, when Tinderbox debuted, action code like this was normal:
Color - blue
But since v4.5 in mid-2008—13+ years ago—this has been deprecated in favour of more explicit writing:
$Color = "blue";
The whitespace in the latter doesn’t matter: everything else, including case-sensitivity, does matter.
So if your existing, old, old code (looking at your opening examples) fails, your first action should be to update to not use legacy syntax. That’s not a slur on you code, but time moves on. If unsure how to update, just post the old code here and forum members can help you update it.
For instance:
If($Name.contains("[")){$QuestionAnswer = A ;}
Would now be written:
if($Name.contains("\[")){$QuestionAnswer = "A";}
Note:
-
if
is lower case and case sensitive
- the
[
in the search pattern is a regex character so must be escaped.
- literal strings like
'A
should be enclosed in quotes (matched single or double, double being the more normal choice).
If the test is that the $Name begins with a [
character, then the correct test is:
if($Name.contains("^\[")){$QuestionAnswer = "A";}
The extra regex ^
ensures that ‘[’ is the first character of $Name.
Here’s a test: Code-update.tbx (75.9 KB)