I have the expression working correctly here: http://regexr.com/3gemo

I tried converting it to a validation rule in Salesforce but the following doesn't even save and keeps throwing a 'Syntax error'enter image description here:


Expected behavior:

  • A label may contain 2 to 63 characters [ Both on the left and right side of (.) ]

  • The characters allowed in their labels are a subset of the ASCII character set, consisting of characters a through z, A through Z, digits 0 through 9, and hyphen -- Cannot use characters with accent marks -- Cannot use symbols except dash -- Cannot use ^ anywhere

  • Labels may not start or end with a hyphen

What am I missing or doing wrong?


1 Answer 1


When you want to escape a character, you need to use two backslash characters (\\) rather than one (\). Also, I do not believe you need to escape forward slash (/) characters in this context.

Requisite changes:

  • Adrian, I thought I had the REGEX nailed down but it doesn't satisfy certain criteria (mistake on my part). Do you recommend posting a new question or should I continue the thread here? Jul 31, 2017 at 16:59
  • New question. Your key issue here was how to get the rule itself to save.
    – Adrian Larson
    Jul 31, 2017 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.