My first thought was to abstract this idea slightly.
So the product basically.....
Allows the user to markup some example text using simple
mouse clicks and selection and then the program uses
this markup to derive a rule ( regular expression) which
can be used to check the validity of further examples...
I don't suppost you'd care to apply this to XML.
Allowing us to create Schemas from Example XML. Please.
Pretty please :D