Etz Posted February 9, 2013 Report Share Posted February 9, 2013 For example webpage contains lots of content in different iframes: "><iframe name="ifrm5" src="../../blah/page_xy.htm" width="345" height="130" vspace="0" hspace="0" marginwidth="0" marginheight="0" frameborder="1"></iframe> How to capture that "blah/page_xy.htm" from there with regex? Considering that I want to identify that by "page_xy" part of url, tried for hours myself and didnt seem to succeed... Basically I came to this: <iframe [^>]*(src="[^"]+")[^>]* Only problem is that it matches URL in first iframe it finds on page, but I need to match a certain one containing certain link, identified by "page_xy.htm" part, in URL. EDIT : Nevermind, found solution already: <iframe [^>]*(src="[^"]+page_xy[^"']+")[^>]* Still have to find out, how to strip ../../ part from that match... Quick and dirty solution: <iframe [^>]*src="../../([^"]+page_xy[^"']+)[^>]* Link to comment Share on other sites More sharing options...
shawn Posted February 10, 2013 Report Share Posted February 10, 2013 Try this: <iframe[^>]*src="[^"a-z0-9]+([^"]+page_xy[^"]+)" Link to comment Share on other sites More sharing options...
Etz Posted February 10, 2013 Author Report Share Posted February 10, 2013 Actually much better, thx... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now