How can I out if a string only contains a certain set of characters: { A-Z and } ?
For example
{VARIABLE}=> should return true{VARiABLE}=> should be false, because there’s a lowercaseiinside{ VARIABLE}=> should be false because there’s a space etc.
Oh, very important:
the string MUST have at least one character between { and }, so:
{}should be false too…
In that case use:
The regexp represents any string of the format:
{}The
^...$makes sure that the string should be exactly of this form, rather than a substring only (otherwisetest{AAA}would match too).