Hello, @dr-ramaanand and all,
Your requests are quite complex. So I imagined a completely different way to solve the different required conditions !
We’ll add one special character, right before any string <code, beginning a line, when the conditions are not respected
Thus, perform, successively, these two regex replacements :
SEARCH (?xs-i) ^ <code (?: (?! <code ). )+? code \x20? {
REPLACE \x{2588}$0
We’re searching, here, for the string code\x20?{ !
And
SEARCH (?xs-i) ^ <code (?: (?! <code ). )+? google_translate_element
REPLACE \x{2588}$0
We’re searching, here, for the string google_translate_element !
Now, it’s quite trivial : simply search for the regex (?-i)^<code which should be the allowed cases, ONLY !
If you test it against my previous sample text, you should get the following modified text :
█<code............>............</code>
<style type="text/css">
code{
font-family: "verdana";
font-size: 19px;
color: black;
font-weight: bold !important;
line-height: 1 !important;
}
}
</style>
<code............>............</code>
<style type="text/css">
</style>
█<code............>............</code>
bla blah
bla blah
bla blah
<style type="text/css">
code{
font-family: "verdana";
font-size: 19px;
color: black;
font-weight: bold !important;
line-height: 1 !important;
}
}
</style>
<code............>............</code>
<style type="text/css">
</style>
<code............>............</code>
bla
blah
bla
blah
bla
blah
<style type="text/css"></style>
█<code............>............</code>
<style type="text/css">
code {
font-family: "verdana";
font-size: 19px;
color: black;
font-weight: bold !important;
line-height: 1 !important;
}
}
</style>
bla
blah
█<code............>............</code>
A lot of text here, spanning many lines
<style type="text/css">
code {
font-family: "verdana";
font-size: 19px;
color: black;
font-weight: bold !important;
line-height: 1 !important;
}
}
</style>
Some text/codes here
<div id="google_translate_element"></div>
<script type="text/javascript">
Some javascript here
</script>
█<code............>............</code>
A lot of text here, spanning many lines
<style type="text/css">
</style>
Some text/codes here
<div id="google_translate_element"></div>
<script type="text/javascript">
Some javascript here
</script>
After analyzing your text, simply run this replacement :
SEARCH \x{2588}
REPLACE Leave EMPTY
BR
guy038