Answer the question
In order to leave comments, you need to log in
How to limit the construction (.+?)?
The essence of the task is:
There is a text with links in the format of a bb-code of the form:
1) [url=" https://wordpress.org/ "]Regular link[/url]
2) [url=" https://wordpress.org / " target="_blank"]Normal link in new window[/url]
The regular expression needs to find only the exact match. I found the option /\[url=\"(.+?)\"\](.+?)\[\/url\]/s, but it also works for cases 1 and 2. I need to find only 1 number.
Answer the question
In order to leave comments, you need to log in
/\[url=\"([^\s"]+?)\"\](.+?)\[\/url\]/s
https://regex101.com/r/e4aZgb/1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question