Skip to content

Commit fb452eb

Browse files
committed
Stricter regex
1 parent 8239aef commit fb452eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tldr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ def emphasise_example(x: str) -> str:
481481
# Extract long or short options from placeholders
482482
if not (shortform and longform):
483483
if shortform:
484-
line = re.sub(r'{{(-.)\|--.+?}}', r'{{\1}}', line)
484+
line = re.sub(r'{{(-.)\|--[^|]+?}}', r'{{\1}}', line)
485485
elif longform:
486-
line = re.sub(r'{{-.\|(--.+?)}}', r'{{\1}}', line)
486+
line = re.sub(r'{{-.\|(--[^|]+?)}}', r'{{\1}}', line)
487487

488488
elements = [' ' * 2 * LEADING_SPACES_NUM]
489489
for item in COMMAND_SPLIT_REGEX.split(line):

0 commit comments

Comments
 (0)