Regular Expressions 101

Community Patterns

Match odd amount of backslashes.

0

Regular Expression
Python

r"
(?:(?<=[^\\])|^)(\\(?:\\{2})*)(?=[^\\]|$)
"
gm

Description

This regular expression will match anytime in a string where an odd amount of backslashes directly following eachother are present.

Submitted by anonymous - 5 years ago