I am writing a validator function in javascript for data entry. I have two conditions I need to test for.
Case 1: All printable ASCII characters between 32 and 126 Case 2: All printable ASCII characters between 32 and 126 plus carriage return and new line.
Here is my regex for Case 1:
/^(?=[ -~])[^\r\n]*$/
Is this suitable for Case 2?
/^(?=[\n-~])[^\013\014\016-\037]*$/