Stream: shorthand
Topic: Ruleset - escaping characters
 Jose Costa Teixeira (Feb 02 2021 at 16:52):
How do I escape ( and ) in rulesets?
 Elliot Silver (Feb 02 2021 at 16:55):
For that matter, using the example from the language reference, how do you escape comma?
* insert Question(tr1, When did you leave?, date, false)
 ryan moehrke (Feb 02 2021 at 16:59):
can't you just use \ to escape whatever you want?
 ryan moehrke (Feb 02 2021 at 17:00):
ah, according to my own fsh testscript resources, you only need to escape the end parenthesis..
* insert AssertExpression ("Observation.exists(\)", false, "Expected: Pass")
 Chris Moesel (Feb 02 2021 at 17:07):
From the current build of the spec:
As indicated, the list of values is enclosed with parentheses
()and separated by commas,. If you need to put literal)or,characters inside values, escape them with a backslash:\)and\,, respectively. White space separating values is optional, and removed before the value is applied to the rule set definition.
 Jose Costa Teixeira (Feb 02 2021 at 17:20):
I was escaping the ( as well... Thanks
 Elliot Silver (Feb 02 2021 at 17:21):
I assume that you also need to escape backslash?
 Chris Moesel (Feb 02 2021 at 17:37):
Ah. Good point. I think you're probably right about that, but would need to take a look at the code to confirm. But assuming you're right, we should probably update the doc to reflect that. Thanks!
 Chris Moesel (Feb 02 2021 at 17:42):
OK, I think you're right.  Escape \ with \ (i.e., \\).  Simple example: https://fshschool.org/FSHOnline/#/share/3tnx1cc
 Elliot Silver (Feb 02 2021 at 17:44):
Should I be seeing something with that link?
 ryan moehrke (Feb 02 2021 at 17:55):
the school links works fine for me, shows that insert DoShort(he\)l\,l\\o) resolves to "short":"he)l,l\o"
 Elliot Silver (Feb 02 2021 at 17:56):
Hmm, interesting. Works in Chrome, but not in Safari.
 Chris Moesel (Feb 02 2021 at 18:09):
Oh, dang. Yeah, that behavior on Safari is not acceptable. Yikes. We'll have to take a look at that.
Last updated: Apr 12 2022 at 19:14 UTC