To include a backslash in a pattern, specify two backslashes: /\\+/ This pattern tests for one or more occurrences of \ in a string.