diff --git a/sopel/modules/find.py b/sopel/modules/find.py index a639e0e237..647c4ac068 100644 --- a/sopel/modules/find.py +++ b/sopel/modules/find.py @@ -163,10 +163,14 @@ def findandreplace(bot, trigger): sep = trigger.group('sep') old = trigger.group('old').replace('\\%s' % sep, sep) - new = bold(trigger.group('new')).replace('\\%s' % sep, sep) + new = trigger.group('new') me = False # /me command flags = trigger.group('flags') or '' + # only clean/format the new string if it's non-empty + if new: + new = bold(new.replace('\\%s' % sep, sep)) + # If g flag is given, replace all. Otherwise, replace once. if 'g' in flags: count = -1