php


Regex that match all js code but not the commented one


The following regex is supposed to match all js:
conditional js (OK: already working)
add js script (OK: already working)
in line js (OK: already working)
but not commented Js ( need to be implemented )
I would like to exclude all js that is commented ( but preserve the one that inside a conditional comment
Here the current regex:
^<!--(\[if lt IE.*?\])>[\s\S]*?<script(\b[^>]*?>)([\s\S]*?)<\/script>[\s\S]*?<!\[endif\]-->$|^<script(\b[^>]*?>)([\s\S]*?)<\/script>$
So skip the match for this kind of text:
<!--
<script type="text/javascript">
SOME JS
</script>
-->
OR
<!--
<script src='...' type="text/javascript"></script>
-->
Conditional comment are usually in this form:
<!--[if lt IE]>
<script type="text/javascript">
Some JS
</script>
<![endif]-->
Is it possible to do all the above in one regex ?
Since this is my first regex, if you have any other suggestion is welcome.
Thanks

Related Links

Find Array value ranges max and min value
How to get currently logged on windows username in PHP without windows authentication
How to check if an array is empty in PHP(Codeigniter)
MYSQL inserting multiple rows unexpectedly
Stripping empty attributes from Laravel model before saving
Unable to trigger .ajaxComplete() function with jQuery function
Error when trying to run multiple mysqli queries
Display only icons using bootstrap nav walker in wordpress
fetch div data from DOM which starts from a specific id name
Using function name as string to call a callable function from another class
new with function and its not working
Yii2 DepDrop kartik
PHP AJAX Pagination via jQuery issue
PHP, Array result in table format in a sequence [closed]
How to join two MySQL queries in PHP
Iterate through directory to build menu structure

Categories

HOME
events
blast
mpdf
yaml
angular-ui-grid
android-fragments
haproxy
fogbugz
iptables
dji-sdk
capistrano
angular2-template
sympy
eddystone
swarm
twitter-oauth
lapack
sap-fiori
squirrel-sql
mailgun
google-tasks-api
vertica
string-formatting
nullreferenceexception
parceler
pfobject
altium-designer
connection-refused
ratio
function-points
react-dnd
environment
points
acrobat
ibm-connections
fatfs
amazon-iam
es6-modules
location-services
windows2012
steam-web-api
gsp
sql-execution-plan
bean-validation
testlink
xvfb
variable-variables
django-smart-selects
klee
viewcontroller
fiware-wirecloud
contactless-smartcard
google-prediction
nuclio
kitura
liteide
image-registration
nothing
uiautomatorviewer
nusoap
iptv
nslayoutconstraint
libharu
dpkg
android-sdcard
processor
django-validation
pack
helm
pythonxy
org-babel
azure-xplat-cli
subfolder
scala-swing
kognitio-wx2
nanomsg
lifetime
windows-rt
oracle-adf-mobile
visual-c++-2012
category-theory
communicate
maven-central
network-printers
windows-messages
screwturn
csslint
thruway
usb-flash-drive
nosql-aggregation
xsd2code
mute
objective-c-runtime
microformats
xs
statechart
dynamic-rdlc-generation
spiral
tfs-sdk
contextswitchdeadlock
image-scanner
opends
drawimage
snackjs
filelock
3des
anonymous-types
active-record-query
mygeneration
ios-4.2
tabbarcontroller
wmd-editor
fxruby
icon-language
activex-exe

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile