• + 0 comments

    and_pattern = "(?<= )\&\&(?= )" or_pattern = "(?<= )||(?= )"

    Explanation: (?<= ) is a look behind positive. This ensures the characters are preceeded by a space. (?= ) is a look ahead positive. This ensures the characters are followed by a space. Finally, the string in question contains characters which themselves are used in regex statement, so they must be escaped with a backslash to be recognized!