Need Regex pattern for phone number validation Java script

Discussão em 'Angular' iniciado por Dev2uk, Janeiro 14, 2025.

  1. Dev2uk

    Dev2uk Guest

    I need regex pattern for phone number with below protocols

    1. Phone number allow + symbol at first position only with optional value

    2.-(hyphen) should not allow first and last position . But hyphen can allow in between number but maximum three hyphen can allow

    3.space can allow in between numbers but continuously should not allow more than one space .. but single space allow n number of times

    Eg.+34 35 45-45-55-4, 34-5-4-45 5 5 555. ->these pattern need to allow

    34 455 55-66— 5–, -455-,444 55 - 5- -55 -> these pattern should not allow

    When I tried

    /^+?\d+(?:-\d+){0,3}(?: \d+){0,}$/gm ->pattern

    33445-445 4556 45666-4566, 33445-445 4556 45666-4566 -> this number combination of space and hyphen not accepting

    Continue reading...

Compartilhe esta Página