What would I do in expression editor to validate that a string meets the basic constraints for a North American phone number? All I care do at this point is compare the entered string and make sure it matches this pattern: [2-9]XX[2-9]XXXXXX
I'm curious, where/how are you getting the number?
Either way, assuming you've already validated the length of digits you can skip the need for regex, granted this method is less robust but simpler to implement:
if(phoneNumber.charAt(0) <= 49 || phoneNumber.charAt(3) <= 49)
Number is invalid
Number is valid.
The way this works is as such: based on the pattern you describe, either the first digit, or the 4th must be between 2 and 9. Based on that, we grab those digits and compare them. The value 49 is the integer value of the character '1', so by testing less than or equal too, you can ensure that the number provided is either 0 or 1
As I said, the code Anthony provided is more robust, you can match on a greater granularity (although I believe his implementation could be improved, no offense Anthony), however if you want to simply ensure they don't input a 0 or 1.
If you'd like to see a table of where all the ASCII string values are, check:
Check this post for the solution (I hope this link still works when they redesign the forums the next time)