Hi, I have for example the following string:
<!-- google_ad_section_start -->Some text bla bla!<!-- google_ad_section_end -->
Now I need a regex to only find the last comment, but only if the string ends with a comment (maybe followed by some white spaces). If there is somebody asking for the sense of this, I need to add a read more link to the End of a teaser text. But sometimes there is after the text a comment (and sometimes also before), as you can see here: http://drupal.org/node/491536
I thought this regex \s*<\!--.*?--\>\s*$ will do it but it returns the whole string between the first <!-- and the last-->. What can I do that the regex will only return the last comment (in the example: <!-- google_ad_section_end --> ) In this case: "<!-- google_ad_section_start -->Some text bla bla!<!-- google_ad_section_end --> some more text" The regex should return nothing, because the comment is not at the end of the string. Any ideas?