score:1

Accepted answer
^\(\d{3}\)\s\d{3}-\d{4}$

This matches the given format exactly

https://regex101.com/r/HBvG3K/6

\( and \) - To escape () characters and match literally  
\s - space character. If there can be more or no spaces then add * next to \s
\d{} - decimal numbers(0-9) followed by quantifier.

let validateSchema = yup.object().shape({
  tel_no: yup
    .string()
    .matches(
      /^\(\d{3}\)\s\d{3}\s-\s\d{4}/g,
      "Telephone number is invalid"
    )
});

score:0

To validate the exact number format (044) 456-7890 I would suggest:

\(\d{3}\)\s*\d{3}-\d{4}

Demo

score:0

I guess it would be better to use a real phone checking library like: https://github.com/catamphetamine/libphonenumber-js


Related Query

More Query from same tag