There is one problem bother me for a long time.
In Python, the regex always match the longest string in the content.
For example, the content is below:
<test> A <br> B <br>
If I use the regex re.compile('/<test/>(\w\s)+/<br/>'), python match longest string which means <test> A <br> B <br>
How can I match the shortest string which is <test> A <br> ?
Thanks for your reading and reply.
Your regex looks really strange. I think you mean:
And in that case you can make it ‘non-greedy’ using a question mark: