Hi, @ganesan-govindarajan and All,
Ah…OK. So, whatever the contents of tags, isn’t it ?
Then the following generic regex should work nice !
SEARCH
(?-i)<(\w+)>(?2)</\1>(*SKIP)(*F)|(\QWhatever you want\E)
Note that the part between the \Q ( for Quote ) and \E ( for End ) is just considered as a literal range of characters !
So, in case of a very simple text to search as, for instance, My text the \Q and \E syntaxes are not necessary and you may use this practical regex :
SEARCH
(?-i)<(\w+)>(?2)</\1>(*SKIP)(*F)|(My text)
When tested against the text, below :
01 <para>My text</para>
02 <blockquote>My text <!-- MISSING tag -->
03 <abc>My text</xyz> <!-- NON-regular syntax -->
04 My text <!-- MISSING tags -->
05 <ganesan>My text</ganesan>
06 <123>My text<456> <!-- NON-regular syntax -->
07 My text</blockquote> <!-- MISSING tags -->
08 <h1>My text</h1>
09 (toto)My text(/toto) <!-- NON-regular syntax -->
10 (Test)My text[/test] <!-- NON-regular syntax -->
it would match the string My text, only in case of non-regular syntax or missing tag. So, in lines 02, 03, 04, 06, 07, 09 and 10 !
Similarly, if you’re looking for wrong syntaxes of the This is a Notepad++ regex. sentence, it’s better to use the syntax, below, as the text, to search for, contains the + and the . signs, which are regex symbols with a special meaning :
SEARCH
(?-i)<(\w+)>(?2)</\1>(*SKIP)(*F)|(\QThis is a Notepad++ regex.\E)
Test it against this similar sample :
01 <para>This is a Notepad++ regex.</para>
02 <blockquote>This is a Notepad++ regex. <!-- MISSING tag -->
03 <abc>This is a Notepad++ regex.</xyz> <!-- NON-regular syntax -->
04 This is a Notepad++ regex. <!-- MISSING tags -->
05 <ganesan>This is a Notepad++ regex.</ganesan>
06 <123>This is a Notepad++ regex.<456> <!-- NON-regular syntax -->
07 This is a Notepad++ regex.</blockquote> <!-- MISSING tags -->
08 <h1>This is a Notepad++ regex.</h1>
09 (toto)This is a Notepad++ regex.(/toto) <!-- NON-regular syntax -->
10 (Test)This is a Notepad++ regex.[/test] <!-- NON-regular syntax -->
Best Regards,
guy038