whereis wrong with my pattern? ask for help

  • 0

    my grep solution, the code is like:

    grep "\(?\d{3}\)?[- ]\d{3}-\d{4}" file.txt

    but when it came across test case "123-456-7891", it didn't print out anything. could someone tell me why please?
    Yet I put test case "123-456-7891" into a file, and open it with notepad++ on windows, using the same pattern to find matched lines, and it worked! That really makes me confused

Log in to reply

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