09-04-2024 01:28 PM
our ERP will allow a user to enter a serial number like 1234*
is there a way to test of an * or & or @ etc is in a text field so i can send an email to a user to fix rather than move the incorrect data to SFDC
thanks
Solved! Go to Solution.
a month ago
You can do this with match or scan, and regex (regular expressions).
Regex is a little complicated to learn IMO, but it is an essential tool for problems like this.
Here is a quick formula that will test for any characters that are not a-z, A-Z, and 0-9. It will return true or false based on the input.
input = "abc@123*"
[input].match?(/[^a-zA-Z\d]/)
## output >> true
You can also use scan to return an array of non-matching characters:
[input].scan(/[^a-zA-Z\d]/)
## output >> ["@", "*"]
a month ago
You can do this with match or scan, and regex (regular expressions).
Regex is a little complicated to learn IMO, but it is an essential tool for problems like this.
Here is a quick formula that will test for any characters that are not a-z, A-Z, and 0-9. It will return true or false based on the input.
input = "abc@123*"
[input].match?(/[^a-zA-Z\d]/)
## output >> true
You can also use scan to return an array of non-matching characters:
[input].scan(/[^a-zA-Z\d]/)
## output >> ["@", "*"]