i have regex function like this:
const format = (value) => {
if (typeof value === 'string') {
return value.replace(/(\d{3})(\d+)/g, '$1-$2');
}
}
when i console without inputing into formik setfieldvalue it produce correct regex like 111-1111111:
const custom = (value) => {
console.log('valuemain',format(value)); //this valuemain: 111-1111111
formikRef.current.setFieldValue('customnumb',value)
}
but when i inputing regex into formik setfieldvalue it becomes like 111-111-111:
const custom = (value) => {
console.log('valuemain',format(value)); //this valuemain: 111-111-111
formikRef.current.setFieldValue('customnumb',format(value))
}