In my Laravel 6.18 project, I have setup VueJS with Webpack manager.
I am working on client-side validation for validating User's Street Address in an application form.
I am using VeeValidate library of VueJS for validations, where we can provide the RegExp along with required validations separated by | symbol.
Now when I try to use the Regex [\w',-\\/.\s] in the application form with necessary character escaping as below, it gives the error SyntaxError: Invalid regular expression: /^[\w'/: Unterminated character class in the Browser's Console tab:
<input type="text"
id="address"
name="address"
v-validate="'required|regex:^[\\w\'\,\-\/\.\\s]*$|max:75'"
class="browser-default"
required v-model="address"
@blur="$emit('local-storage', 'address', address)"/>
<span class="missing-alert" v-show="errors.has('address')">Enter valid address</span>
Can anyone assist in understanding what's the syntactic error when using the said Regex inside Vue document textbox code ?
v-validate="'required|regex:/^[\\w\\/.\\',\\s-]*$/|max:75'"v-validate="'required|regex:/^[\\w\\/.\\x27,\\s-]*$/|max:75'"?