Why my solution is wrong


  • 0
    I
    cat file.txt | awk '/^ *[0-9]{3}-[0-9]{3}-[0-9]{4} *$/{print $0} /^ *\([0-9]{3}\) [0-9]{3}-[0-9]{4} *$/{print $0}'
    

    my solution faild on 123-456-7891


  • 0
    O

    cat file.txt | grep -E "^((([0-9]{3})\s)|([0-9]{3}-))[0-9]{3}-[0-9]{4}$"


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.