Add URL regex pattern

This commit is contained in:
Veronica Berglyd Olsen
2024-10-25 17:49:53 +02:00
parent 439a04c603
commit 37268b873a
3 changed files with 53 additions and 2 deletions
+6
View File
@@ -32,6 +32,7 @@ from novelwriter.constants import nwRegEx
class RegExPatterns:
# Static RegExes
_rxUrl = re.compile(nwRegEx.URL, re.ASCII)
_rxWords = re.compile(nwRegEx.WORDS, re.UNICODE)
_rxBreak = re.compile(nwRegEx.BREAK, re.UNICODE)
_rxItalic = re.compile(nwRegEx.FMT_EI, re.UNICODE)
@@ -40,6 +41,11 @@ class RegExPatterns:
_rxSCPlain = re.compile(nwRegEx.FMT_SC, re.UNICODE)
_rxSCValue = re.compile(nwRegEx.FMT_SV, re.UNICODE)
@property
def url(self) -> re.Pattern:
"""Find URLs."""
return self._rxUrl
@property
def wordSplit(self) -> re.Pattern:
"""Split text into words."""