Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(<)(script[^>]*>[^<]*(?:<(?!\/script>)[^<]*)*<\/script>|\/?\b[^<>]+>|!(?:--\s*(?:(?:\[if\s*!IE]>\s*-->)?[^-]*(?:-(?!->)-*[^-]*)*)--|\[CDATA[^\]]*(?:](?!]>)[^\]]*)*]])>)|(e)
/
gi
Input 1
1
New
<html> <div>This can match but the part inside script/cdata can not</div> <div style="display: none;"> <script type="text/javascript"> //<![CDATA[ function add_filter() { select = $('add_filter_select'); field = select.value Element.show('tr_' + field); check_box = $('cb_' + field); check_box.checked = true; toggle_filter(field); select.selectedIndex = 0; for (i=0; i<select.options.length; i++) { if (select.options[i].value == field) { select.options[i].disabled = true; } } } function toggle_filter(field) { check_box = $('cb_' + field); if (check_box.checked) { Element.show("operators_" + field); toggle_operator(field); } else { Element.hide("operators_" + field); Element.hide("div_values_" + field); } } function toggle_operator(field) { operator = $("operators_" + field); switch (operator.value) { case "!*": case "*": case "t": case "w": case "o": case "c": Element.hide("div_values_" + field); break; default: Element.show("div_values_" + field); break; } } function toggle_multi_select(field) { select = $('values_' + field); if (select.multiple == true) { select.multiple = false; } else { select.multiple = true; } } function apply_filters_observer() { $$("#query_form input[type=text]").invoke("observe", "keypress", function(e){ if(e.keyCode == Event.KEY_RETURN) { new Ajax.Updater('content', '/issues?set_filter=1', {asynchronous:true, evalScripts:true, onComplete:function(request){e.stop(); apply_filters_observer()}, parameters:Form.serialize('query_form') + '&authenticity_token=' + encodeURIComponent('yMZ98jonoXHvM+ePOoJ0weTV+jYqVDD/MbRcEhSMp9g=')}) } }); } Event.observe(document,"dom:loaded", apply_filters_observer); //]]> </script> <table width="100%"> <title>car</title> <span>assigned</span> <span>Assigned > to</span> <span>assigned > to</span> <div>ticket assigned to</div> <div id="assigned" class="assignedClass">Ticket being assigned to</div> </html> /*<![CDATA[*/ body { background-image: url("test.png") } e]]> <script>function assigned_to()</script> <html> <span>assigned</span> ==> should be found <span>Assigned > to</span> ==> should be found <![CDATA[ <script>function assigned_to()</script> ==> should be ignored ]]> //<![CDATA[ <script>function assigned_to()</script> ==> should be ignored ]]> // <span>assigned > to</span> ==> should be found <div>ticket assigned to</div> ==> should be found <div id="assigned" class="assignedClass">Ticket being assigned to</div> ==> should be found </html>
Substitution