Simple Regex - logic help needed to match a string but not as character class

kraze2007

New Member
I have the following sample template code.\[code\]{# @T('core.layout:Logged in as {0} {1}', @user('firstname'), @user('lastname')) #} {# VAR_TEST #}\[/code\]And the following regex used to parse for the tags\[code\]/{# (\@)?(([A-Z][^#}]+)|(([a-zA-Z0-9\_]+)?\(([^#}]*)\))) #}/\[/code\]However it only matches the last tag because of the close curly braces (}) in the first tag. I'm no expert in regex and thus the problem. I'm attempting to limit the matching by stopping the tags matching anything after the tag close #} by using the every character except #} pattern, ie [^#}]. However this is matching individual characters and not the #} string as a whole.How to you write a regex to match everything but a string but not in character class mode?Fyi, the regex flavour is PHP and preg_match.Edit 1;So I need to match \[code\]{# @T('core.layout:Logged in as {0} {1}', @user('firstname'), @user('lastname')) #}\[/code\]and\[code\]{# VAR_TEST #}\[/code\]with the same regex. however the first test match indicates a very complicated tag which is broken down with further regexes at a later point.
 
Back
Top