I need a regular expression for php that outputs everything between <!--:en--> and <!--:-->.
So for <!--:en-->STRING<!--:--> it would output just STRING.
EDIT: oh and the following <!--:--> nedds to be the first one after <!--:en--> becouse there are more in the text..
The one you want is actually not too complicated:
Your matches will be in capture group 1.
Explanation:
The
.*?is a lazy quantifier. Basically, it means “keep matching until you find the shortest string that will still fit this pattern.” This is what will cause the matching to stop at the first instance of<!--:-->, rather than sucking up everything until the last<!--:-->in the document.Usage is something like
preg_match("/<!--:en-->(.*?)<!--:-->/gi", $input)if I recall my PHP correctly.