Currently, I am in the process of validating inputs for special characters within my Angular application. One specific requirement is that the space between words should be allowed. Although I am new to regex, I am eager to learn and improve.
Below is the test scenario:
it('should test for special character', () => {
let format = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/;
expect(format.test("Hello Angular")).toEqual(false);
})
In order for the test to pass successfully, it needs to return false
. Therefore, I would appreciate any guidance on how to adjust the format in a way that captures all special characters except for the underscore
and the space
between two words.