I have integrated Vuelidate plugin for my Nuxt project and I want to add a custom validation to it in which whenever the user inputs a URL then www. get replaced and then I can check that String with the regex (?:(?:[a-zA-Z0-9])(?:[-.][a-zA-Z0-9])?)+(?:\.[a-z]{2,6})+$
This is the way I am trying to achieve it
const customValidate = (value, vm) => {
this.domainCheck = value.replaceAll('www.')
return vm.domainCheck.match(
/(?:(?:[a-zA-Z0-9])(?:[-.][a-zA-Z0-9])?)+(?:\.[a-z]{2,6})+$/
)
}
data(){
return{
domainName: ''
domainCheck : ''
}
}
validations:{
domainName:{
customValidate
}
}
Is there a way to achieve this or only possible after submitting the form and there checking for the validation?