RegEx question

I need a RegEx to determine if a “word” meets a pattern

the Pattern is

  • Must start with $, # ! or %
  • which must be followed by a letter
  • which then can optionally be followed by letters or numbers

this is what I have … which seems to work

let FILE_REGEX = "^[$#!%][A-Za-z][A-Za-z0-9]*?$" 

first off… is this in fact correct?
and second. how can it be modifed so that it can start with any number of “$”

so that

  • $$$X is valid
  • %%X is NOT

ie. only the $ can have more than 1 instance

seems something like
([\#\!\%]|\$+)[a-zA-Z][a-zA-Z0-9]*

^([#!%]|\\$+)[a-z][a-z\\d]*$

Or if underscores are ok after the first letter:

^([#!%]|\\$+)[a-z]\\w*$

Also note that [A-Za-z] may meet your definition of “a letter” but some international folks may beg to differ

Quite right. If that’s a concern, use this instead:

\\p{L}

Thanks
A-Z is what I need… its to validate a variable name in the PILOT language