regexmatch error

Hi All,

I am getting error for pattern  below  

("^[a-z._-@'0-9A-Z]+$")

Error is illegal character range near index 8 . it is near dot.

Please let me know if  any acceptable pattern for below charater. 

thanks

Sushma.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    Just a quick guess here but I assume this might be because of the "-" between "_" and "@" -- per my recollection, inside the [] operators, "-" implies you're defining a range (like "a-z" and "0-9"), but then you have "_-@" which... isn't a range?  If your intent is that "-" is a literally allowed character, you probably need to escape it.

    regexmatch(
      pattern: "^[a-z._\-@'0-9A-Z]+$",
      searchString: "asdf"
    )

Reply
  • +1
    Certified Lead Developer

    Just a quick guess here but I assume this might be because of the "-" between "_" and "@" -- per my recollection, inside the [] operators, "-" implies you're defining a range (like "a-z" and "0-9"), but then you have "_-@" which... isn't a range?  If your intent is that "-" is a literally allowed character, you probably need to escape it.

    regexmatch(
      pattern: "^[a-z._\-@'0-9A-Z]+$",
      searchString: "asdf"
    )

Children