regex - php preg_match_all conditional pattern -


the php pattern regex syntax stuff gives me headaches... i'm trying match javascript tags except js tags id="pagespeed", can move them somewhere else. need pattern condition, else done.

i'm having this:

  $jspattern = '#<script.*</script>#isum'; 

which finds tags, , need check exceptional condition not true. should like:

 ~^<script.+id=\"pagespeed\".*</script>]~ 

the line wrong , needs combined line above. great if me seem suck @ pcre syntax :(

i use @casimir's answer purpose.. if looking regex.. use below pattern:

<script[^>]*id="(?!pagespeed\b)[^"]+".*<\/script> 

see demo


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -