I have a string like so {!Hello} there, {!World}
. I need to match {!Hello}
and {!World}
and I have my regex like so
$text = '{!Hello} there, {!World}';
preg_match_all("/\{\!.+\}/",$text,$var);
The problem is it matches the whole thing from beginning to end. That obviously means it's not stopping at the first occurrence of }
but rather the last one. How can I match those?
EDIT: Forgot to mention I can't use \w+ because the word in between the brackets may contain special characters. IT may be something like {!Email__email@some.domain__IsInvalid}
. I need to match this whole thing