Skip to content

Commit

Permalink
[find] Properly account for backslashed slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
embolalia committed Mar 1, 2013
1 parent d07e25d commit 9c0bb04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion find.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def findandreplace(willie, trigger):
#TODO rest[0] is find, rest[1] is replace. These should be made variables of
#their own at some point.
rest = [trigger.group(2), trigger.group(3)]
rest[0] = rest[0].replace(r'\/', '/')
rest[1] = rest[1].replace(r'\/', '/')
me = False # /me command
flags = (trigger.group(4) or '')

Expand Down Expand Up @@ -120,7 +122,7 @@ def findandreplace(willie, trigger):
#slash is ignored, you can escape slashes with backslashes, and if you want to
#search for an actual backslash followed by an actual slash, you're shit out of
#luck because this is the fucking regex of death as it is.
findandreplace.rule = r'(?:(\S+)[:,]\s+)?s/((?:[^/]|\\/)+)/((?:[^/]|\\/)+)(?:/(\S+))?'
findandreplace.rule = r'(?:(\S+)[:,]\s+)?s/((?:\\/|[^/])+)/((?:\\/|[^/])+)(?:/(\S+))?'
findandreplace.priority = 'high'


0 comments on commit 9c0bb04

Please sign in to comment.