Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Valid daml variable namesForum ↗

Valid daml variable names

App Development2 posts302 views4 likesLast activity Jul 2020
DL
dliakakosOP
Jul 2020

I am trying to define a regex that will match a valid variable name in daml.
For example alice is allowed whereas Alice is not.

I have this so far: ^[a-z][a-zA-Z0-9'_]*$

Is it correct? Thanks

CO
cocreature
Jul 2020

DAML follows the Haskell syntax for variable names which is described here. The definition for varId is the correct one (ignoring symbolic infix operators). You are pretty close. Ignoring unicode characters, the correct regex is ^[a-z_][a-zA-Z0-9'_]*$. Of course reserved keywords like case are excluded so it’s not quite accurate but probably good enough™.

← Back to Discussions