This question follows from .net regex - strings that don't contain full stop on last list item
Problem is now the below. Note that examples have been amended and more added - all need to be satisfied. Good examples should return no matches, and bad examples should return matches.
I'm trying to use .net regex for identifying strings in XML data that don't contain a full stop before the last tag. I have not much experience with regex. I'm not sure what I need to change & why to get the result I'm looking for.
There are line breaks and carriage returns at end of each line in the data.
A schema is used for the XML. We have no access to .Net code - just users using a custom built application.
Example 1 of bad XML Data - should give 1 match:
<randlist prefix="unorder">
<item>abc</item>
<item>abc</item>
<item>abc</item>
</randlist>
Example 2 of bad XML Data - should give 1 match:
<randlist prefix="unorder">
<item>abc. abc</item>
<item>abc. abc</item>
<item>abc. abc</item>
</randlist>
Example 1 of good XML Data - regexp should give no matches - full stop preceding last </item>
:
<randlist prefix="unorder">
<item>abc</item>
<item>abc</item>
<item>abc.</item>
</randlist>
Example 2 of good XML Data - regexp should give no matches - full stop preceding last </item>
:
<randlist prefix="unorder">
<item>abc. abc</item>
<item>abc. abc</item>
<item>abc. abc.</item>
</randlist>
Reg exp patterns I tried that didn't work (either false positives or no matches using https://regex101.com/) for criteria above in the bad XML data (not tested on good XML data):
^<randlist \w*=[\S\s]*\.*[^.]*<\/item>[\n]*<\/randlist>$
^\s+<item>[^<]*?(?<=\.)<\/item>$