I am trying to validate text area. Format should be us following:
Text description: ${VARIABLE_NAME} \n
Text description: ${VARIABLE_NAME}
Rules:
- Text description can contain a-zA-Z0-9 spaces and "_"
- Text description need to be followed ":"
- ":" can be followed with no or one space
- after ": " string need to start with "${"
- "VARIABLE_NAME" can contain only A-Z and "_"
- "VARIABLE_NAME" and line need to finish with "}"
Text can have multiple lines, every line need to follow all 6 rules.
For now i have this regex const regex = new RegExp('[\\w+]:\\$\\{[A-Z]+}$', 'gs');
Just not sure how to handle multiple lines.