Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1111861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:36:55+00:00 2026-05-17T02:36:55+00:00

I have the following sample template code. {# @T(‘core.layout:Logged in as {0} {1}’, @user(‘firstname’),

  • 0

I have the following sample template code.

{# @T('core.layout:Logged in as {0} {1}', @user('firstname'), @user('lastname')) #} {# VAR_TEST #}

And the following regex used to parse for the tags

/{# (\@)?(([A-Z][^#}]+)|(([a-zA-Z0-9\_]+)?\(([^#}]*)\))) #}/

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

{# @T('core.layout:Logged in as {0} {1}', @user('firstname'), @user('lastname')) #}

and

{# VAR_TEST #}

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.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:36:56+00:00Added an answer on May 17, 2026 at 2:36 am

    Use a negative lookahead assertion: (?!#}).

    But personally I would write the PCRE as: /{#.*?#}/ That’s way more straightforward 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in a liquid template: <a href={{ sample.url }}>{{ sample.url
I have the following sample code and noticed that if I attempt to use
I have the following sample code which doesn't seem to want to run. import
I have the following code sample that im trying to wrap my head around
I have the following code sample: float val = 16777216.0F; var badResult = Convert.ToDecimal(val);
I have the following code sample, which produces an error with the included constant
I have a problem with the following code: template <typename U> class lamePtr {
I have the following code in Play 2.0 template: @content.toString.lines.map{ case line => //
I have the following code which I am using for making a simple template
I have the following sample data: Id Name Quantity 1 Red 1 2 Red

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.