I'm trying to develop regular expressions to check syntax for question writing for a quiz module.
One question type is drag and drop which has the format ...
the {rain} falls gently on the {plain}
... where the bracketed terms are draggable. There has to be at least one bracketed term but they can come anywhere in the string. The doesn't need to be anything between the bracketed terms either. So any of the following are valid ...
{the} rain falls gently on the plain
the rain falls gently on the {plain}
{the} {rain} {falls} {gently} {on} {the} {plain}
{the }{rain }{falls }{gently }{on }{the }{plain}
Also, to complicate matters, there can't be any square brackets inside the braces - this is another question type. So ...
{the} {rain}
... is OK, but ...
{the} {[rain]}
... is not and any other combination.
So far, I've got this but it clearly doesn't work :(
(.*\{.*\})+
Please can someone help me out?
{and}between the{}?