请教下preg_match的问题
请教下各位大牛,如何抓取一个页面然后匹配页面中的所有链接是js的。目前我这么做的
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function getLink($code){ preg_match_all("/src=[\'\"]{0,1}([^>\'\"]*).*js/i"),$code,$link); return $link[1];}
可是调用的时候碰到页面理的js链接如下的时候就输出不正常了。
http://www.test.com/1.js?eGo
-----这个只能输出http://www.test.com/1.
http://www.test.com/2.js
-----这个能正常输出http://www.test.com/2.js
求指点
------解决方案--------------------
preg_match_all("/src=[\'\"]{0,1}([^>\'\"]*.*js?)/i"),$code,$link); //这样呢?
------解决方案--------------------
preg_match_all("/src=[\'\"]{0,1}([^>\'\"]*.*js)/iU",$code,$link);
结果中会包含 mre_src 部分的内容,若不想要,则
preg_match_all("/\bsrc=[\'\"]{0,1}([^>\'\"]*.*js)/iU",$s,$link);
------解决方案--------------------
- PHP code
$str='<script src="test.js" type="text/javascript" mre_src="test.js"></script>';$pattern='/\bsrc=[\'"]?([^"\']+\.js)/U';preg_match_all($pattern,$str,$matches);print_r($matches);<div class="clear"> </div>

LeicareleasedtheLeicaLuxcameraappfortheAppleiPhoneafewdaysago.However,theappwasnotdevelopedbyLeica,butbyFjorden.ThecompanyhasbeenknownprimarilyforitscameragripsfortheiPhoneandwasacquiredbyLeicainDecember2023.Fo

SincethedemiseofLogitech'spopularHarmonyremotecontrols,themarketforhigh-qualityuniversalremotecontrolshasbeenfragmentedatbest.UnfoldedCircleaimstoavoidthefateoftheHarmonyUltimatebyeliminatinganyserverobligationsorsubs

In2012,theeminentautomotivejournalistJeremyClarksonstatedthattheLamborghiniAventador,whichhewasreviewingatthetime,wouldbeamongthelastcarstofeatureanaturallyaspiratedV12.Morethanadecadelater,V12-poweredsupercarsareal

WhiletheLightPhone2from2018wasstillequippedwithaneconomicale-inkdisplay,theLightPhone3usesanOLEDdisplaythatcanonlydisplaygrayscale.Thereasonfortheswitchtothe3.92-inchOLEDpanelwithitsresolutionof1,240x1,080isth

Audio-TechnicahasunveiledtheATH-S300BTwirelessheadphoneswithhear-throughnoise-cancellation,multipointpairing,and90hoursofbatterylife.Thenoise-cancellingfeaturehasthreemodes:off,on,andhear-through,whereambientsoundscanbehea

Backin2022,whenPCIe7.0wasstartingtotakeshapeasafuturestandard,PCIe5.0wasjusthittingtheservermarketsandtheprospectofseeingPCIe6.0devicesavailableanytimesoon,letalonePCIe7.0ones,wasquitefar-fetched.CurrentlyPCIe5

TheJabraEliteserieshascometoanend,withGNCEOPeterKarlstromerannouncingthediscontinuationofthewirelessearbudswithinthelineupinapressrelease.Petersaysthatthechangingmarketdynamicsandhowchallengingithasbecometogetas

TheHYgreenGOMOWrobotlawnmowerisduetolaunchinGermanysoonandcouldarriveinothercountriesinthefuture.Theproductwillbeshownatspoga+gafa2024inColognefromJune16thto18th,withtheCalifornia-basedcompanylocatedatHall5.1St


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version
Visual web development tools