diff --git a/Notepad/Element.swift b/Notepad/Element.swift index 2a566c2..af8e186 100644 --- a/Notepad/Element.swift +++ b/Notepad/Element.swift @@ -19,8 +19,8 @@ public enum Element: String { case body = ".*" - case bold = "\\**(?:^|[^*])(\\*\\*(\\w+(\\s\\w+)*)\\*\\*)" - case italic = "\\**(?:^|[^*])(\\*(\\w+(\\s\\w+)*)\\*)" + case bold = "(^|[\\W_])(?:(?!\\1)|(?=^))(\\*|_)\\2(?=\\S)(.*?\\S)\\2\\2(?!\\2)(?=[\\W_]|$)" + case italic = "(^|[\\W_])(?:(?!\\1)|(?=^))(\\*|_)(?=\\S)((?:(?!\\2).)*?\\S)\\2(?!\\2)(?=[\\W_]|$)" case boldItalic = "(\\*\\*\\*\\w+(\\s\\w+)*\\*\\*\\*)" case code = "(`\\w+(\\s\\w+)*`)"