My grep -w solution


  • 0
    B
    cat file.txt | grep -w '^[[:digit:]]\{3\}-[[:digit:]]\{3\}-[[:digit:]]\{4\}$\|^([[:digit:]]\{3\}) [[:digit:]]\{3\}-[[:digit:]]\{4\}$'
    

Log in to reply
 

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