Python Forum

Full Version: Non-greedy regex
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am struggling to correctly set up a non-greedy regex to correct the following:

<a href=’tw://bible.*?id=1.2.7>Gen 2:7; <a href=’tw://bible.*?id=1.2.17>Gen 2:17; 5:29

Must become:
<a href=’tw://bible.*?id=1.2.7>Gen 2:7; <a href=’tw://bible.*?id=1.2.17>Gen 2:17; <a href=’tw://bible.*?id=1.5.7> Gen 5:29

Note the 1.5.7 refers to Genesis chapter 5 verse 7
What have you tried?