Hi, @dr-ramaanand and all,
I do not understand why you think that the following regex is OK !
(?s)(<code.*?code\x20\{\s*font-family|<div id="google_translate_element"></div>\s*<script.*?</script>)(*SKIP)(*F)|<code
Apparently, against the sample text, used before and pasted in a new tab :
<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>
MATCH
¯¯|¯¯
|
v
<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>
It just selects the last line beginning with <code !
However, in a previous post, you said :
it should skip what is between <div id="google_translate_element"></div>\s*<script type="text/javascript"> and </script> …
And, precisely, this last line beginning with <code, is, indeed, followed, further on, with the block :
(?s)<div id="google_translate_element"></div>\s*<script type="text/javascript">.+?</script>
Thus, it should not have been matched ?!
Anyway, if this regex above seems to work nicely for you, that’s the main thing !
Best Regards,
guy038