-1

I need to get the text inside the parenthesis where the text ends with .md using a regex (if you know another way you can say it) in python.

Original string: [Romanian (Romania)](books/free-programming-books-ro.md)

Expected result: books/free-programming-books-ro.md

chillin
  • 45
  • 8

1 Answers1

1

This should work:

import re
s = '[Romanian (Romania)](books/free-programming-books-ro.md)'
result = re.findall(r'[^\(]+\.md(?=\))',s)

['books/free-programming-books-ro.md']
Alain T.
  • 40,517
  • 4
  • 31
  • 51