Page 1 of 1

regex to find js links

Posted: Tue May 11, 2010 8:11 am
by klevis miho
I need a regular expression to find javascript links in a given webpage.

Re: regex to find js links

Posted: Sun May 16, 2010 1:03 am
by jimmy patel
This expression may help you in finding src js files in given html code

Code: Select all

preg_match_all(~<\s*script[^>]+src=[\"\'](.*?)[\"\'][^>]+>~im, $html_source_code, $Arr_MatchJs);

MoonRose Infotech
w: http://www.moonroseinfotech.com

Re: regex to find js links

Posted: Mon May 17, 2010 4:01 am
by klevis miho
thnx man

Re: regex to find js links

Posted: Mon May 17, 2010 10:15 am
by klevis miho
This didnt work for me :(.

This yes: #<script[\s]+type=[\'\"]text/javascript[\'\"][\s]+src=[\'\"](.+?)[\'\"]></script>#s
but it is missing something