Skip to content

Commit daee07e

Browse files
committed
fix: update regex patterns in markdown parsing functions for consistency
1 parent b5c9868 commit daee07e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/common/utils/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def run(*args, **kwargs):
370370

371371

372372
def parse_md_image(content: str):
373-
matches = re.finditer("!\[.*?\]\(.*?\)", content)
373+
matches = re.finditer(r"!\[.*?\]\(.*?\)", content)
374374
image_list = [match.group() for match in matches]
375375
return image_list
376376

@@ -438,7 +438,7 @@ def flat_map(array: List[List]):
438438

439439

440440
def parse_image(content: str):
441-
matches = re.finditer("!\[.*?\]\(\.\/oss\/(image|file)\/.*?\)", content)
441+
matches = re.finditer(r"!\[.*?\]\(\.\/oss\/(image|file)\/.*?\)", content)
442442
image_list = [match.group() for match in matches]
443443
return image_list
444444

@@ -447,7 +447,7 @@ def parse_file_link(content: str):
447447
"""Return non-image markdown links and HTML src refs pointing to ./oss/file/ paths."""
448448
results = []
449449
# Regular markdown links (not images): [text](./oss/file/...)
450-
for m in re.finditer(r'(?<!!)\[.*?\]\(\.\/oss\/(?:image|file)\/[^)]+\)', content):
450+
for m in re.finditer(r"(?<!!)\[.*?\]\(\.\/oss\/(?:image|file)\/[^)]+\)", content):
451451
results.append(m.group())
452452
# HTML tags with src pointing to oss paths, e.g. <video src="./oss/file/...">
453453
for m in re.finditer(r'<\w+[^>]+\bsrc=["\'](\./oss/(?:image|file)/[^"\']+)["\']', content):

0 commit comments

Comments
 (0)