I'm trying to solve a quiz of regex for days but still can't get it right. I'm getting so close but still can't get it to pass.
In an HTML page, replace the text
micro
withµ
. Oh, and don't screw up the code: don't replace inside<the tags>
or&entities;
micro
-> µ
abc micro
-> abc µ
micromicro
-> µµ
µmicro
-> µµ
<tag micro />
-> <tag micro />
µ
-> µ
&abcmicro123;
-> &abcmicro123;
I tried this but it fails on the last µ
, what did I miss? Can someone point out what did I miss? Thanks in advance!
((?:\G|\n)(?:.*?&.*?micro.*?;[\s\S]*?|.*?<.*?micro.*?>[\s\S]*?|.)*?)micro
$1µ
You can try something like this:
(?:<.*?>|&\w++;)(*SKIP)(*F)|micro
replacement string:
µ