I want to extract different .swf files from different sites for a project. Different sites use different source methods so I can’t use src= or data= in my regex.
I’m able to match the file name with /[\w-]+.swf/g , but when I try to match the full path( http(.*?).swf ) starting with http it matches another http before the path (the first one in the code). Also I can’t use src= or data= etc, it must be only the link.
Basically, is there a way to limit the match to the first http found when searching backwards?
If anyone cares to take a look then here’s the code: http://pastebin.com/kT20UqqJ .
And here’s a good place to test regex: http://regex.larsolavtorvik.com/
Try the following one:
You need to escape the
.else it will match an arbitrary character and the/since it is the expression delimiter.You can see the working Example here.