Skip to content

Commit bc5b964

Browse files
authored
Merge pull request #2447 from sopel-irc/find-pipe-flags
find: fix flags in pipe-separated substitutions
2 parents 3d85225 + 5c8202e commit bc5b964

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

sopel/modules/find.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,32 +122,32 @@ def kick_cleanup(bot, trigger):
122122
# If you want to search for an actual slash AND a pipe in the same message,
123123
# you can escape your separator, in old and/or new.
124124
@plugin.rule(r"""(?:
125-
(?P<nick>\S+) # Catch a nick in group 1
126-
[:,]\s+)? # Followed by optional colon/comma and whitespace
127-
s(?P<sep>/) # The literal s and a separator / as group 2
128-
(?P<old> # Group 3 is the thing to find
129-
(?:\\/|[^/])+ # One or more non-slashes or escaped slashes
125+
(?P<nick>\S+) # Catch a nick in group 1
126+
[:,]\s+)? # Followed by optional colon/comma and whitespace
127+
s(?P<sep>/) # The literal s and a separator / as group 2
128+
(?P<old> # Group 3 is the thing to find
129+
(?:\\/|[^/])+ # One or more non-slashes or escaped slashes
130130
)
131-
/ # The separator again
132-
(?P<new> # Group 4 is what to replace with
133-
(?:\\/|[^/])* # One or more non-slashes or escaped slashes
131+
/ # The separator again
132+
(?P<new> # Group 4 is what to replace with
133+
(?:\\/|[^/])* # One or more non-slashes or escaped slashes
134134
)
135-
(?:/ # Optional separator followed by group 5 (flags)
135+
(?:/ # Optional separator followed by group 5 (flags)
136136
(?P<flags>\S+)
137137
)?
138138
""")
139139
@plugin.rule(r"""(?:
140-
(?P<nick>\S+) # Catch a nick in group 1
141-
[:,]\s+)? # Followed by optional colon/comma and whitespace
142-
s(?P<sep>\|) # The literal s and a separator | as group 2
143-
(?P<old> # Group 3 is the thing to find
140+
(?P<nick>\S+) # Catch a nick in group 1
141+
[:,]\s+)? # Followed by optional colon/comma and whitespace
142+
s(?P<sep>\|) # The literal s and a separator | as group 2
143+
(?P<old> # Group 3 is the thing to find
144144
(?:\\\||[^|])+ # One or more non-pipe or escaped pipe
145145
)
146-
\| # The separator again
147-
(?P<new> # Group 4 is what to replace with
148-
(?:\\\||[^|])* # One or more non-pipe or escaped pipe
146+
\| # The separator again
147+
(?P<new> # Group 4 is what to replace with
148+
(?:\\\||[^|])* # One or more non-pipe or escaped pipe
149149
)
150-
(?:| # Optional separator followed by group 5 (flags)
150+
(?:\| # Optional separator followed by group 5 (flags)
151151
(?P<flags>\S+)
152152
)?
153153
""")

0 commit comments

Comments
 (0)