Hi there,
i need to find inline javascript with php regex. I can find external script, but not inline, can anybody help me?
Here is my pattern for external:
"/<script(.*?)src(.*?)>(.*?)<\/script\s*>/smi"
Any ideas?
Hi there,
i need to find inline javascript with php regex. I can find external script, but not inline, can anybody help me?
Here is my pattern for external:
"/<script(.*?)src(.*?)>(.*?)<\/script\s*>/smi"
Any ideas?
update: and only the <script>
nodes without the src
attribute set:
"/<script((?:(?!src=).)*?)>(.*?)<\/script>/smix"
(my first look-ahead regex ;))
You need to find all those cases where inline script can be used (i.e. all listener functions onClick, onBlur, onMouseDown, onMouseUp, on...)).
If you plan to filter certain HTML (JS for example), use HTML Purifier.