diff --git a/mobile/ios/BuzzPushKit/Sources/BuzzPushKit/BuzzPushNotificationResolver.swift b/mobile/ios/BuzzPushKit/Sources/BuzzPushKit/BuzzPushNotificationResolver.swift index ecc1fbec50..4cca35d1fc 100644 --- a/mobile/ios/BuzzPushKit/Sources/BuzzPushKit/BuzzPushNotificationResolver.swift +++ b/mobile/ios/BuzzPushKit/Sources/BuzzPushKit/BuzzPushNotificationResolver.swift @@ -769,7 +769,7 @@ public final class BuzzPushNotificationResolver: BuzzPushNotificationResolving { .replacingOccurrences( of: #"!?\[([^\]]*)\]\([^)]*\)"#, with: "$1", options: .regularExpression) .replacingOccurrences( - of: #"(\*\*|~~)(\S(?:.*?\S)?)\1"#, with: "$2", options: .regularExpression) + of: #"(\*\*|~~)(\S(?:.*?\S)??)\1"#, with: "$2", options: .regularExpression) .replacingOccurrences(of: #"[ \t]+"#, with: " ", options: .regularExpression) } diff --git a/test-fixtures/notification-body.json b/test-fixtures/notification-body.json index 9ba167c064..a10ab255e2 100644 --- a/test-fixtures/notification-body.json +++ b/test-fixtures/notification-body.json @@ -152,6 +152,21 @@ "input": "**Run `fetch()` now** and ~~`old()`~~", "expected": "Run fetch() now and old()" }, + { + "name": "each bold run ends at its first closing marker", + "input": "option **A** or option **B**", + "expected": "option A or option B" + }, + { + "name": "each strikethrough run ends at its first closing marker", + "input": "~~x~~ and ~~y~~", + "expected": "x and y" + }, + { + "name": "a one-character bold run can be an emoji", + "input": "**😀** and **b**", + "expected": "😀 and b" + }, { "name": "markup inside code stays literal", "input": "Use `**[a](b)**` as is",