As a newcomer to VueJS, I am currently developing an application that requires a signup and login system. My goal is to inform the user if they have entered a special character such as /[&^$*_+~.()\'\"!\-:@]/
. In order to achieve this, I have implemented the use of the includes
method in my signup.vue
file. While includes
works well with individual characters, it does not seem to function correctly with a string of characters. How can I address this issue?
var character = /[&^$*_+~.()\'\"!\-:@]/
if (this.name.includes(character) || this.lastname.includes(character)) {
this.feedback = 'Special character present, please correct'
}