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

  • Home
  • SEARCH
  • 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 8542279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:01:29+00:00 2026-06-11T12:01:29+00:00

Ok so I am having trouble solving a problem with having a Regex using

  • 0

Ok so I am having trouble solving a problem with having a Regex using JAVASCRIPT with a small time application I am making.

To create a variable in my application a user input is received in the following format:

begin with {

end with }

have var(varName,YES OR NOT IN HERE)= ANYTHING

Example:

{var(myVar,YES)=tryHard}

or

{var(someOther,NO)=552*232}

Here is the regex I am currently using to verify this format:

/{var\([\d\w]{1,10},(YES|NO)\)=.*}$/

Problem is verifying the following text:

someGarbageHere{var(myVar,YES)=2*5}moreGarbagehere

Any ideas? I was thinking there would be some sort of flag but that did not pan out. Also I am thinking that maybe starting the string with . << any character might be a solution but I really just want the text enclosed in the curly braces.

  • 1 1 Answer
  • 0 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-06-11T12:01:30+00:00Added an answer on June 11, 2026 at 12:01 pm

    Do you want that text to be accepted or not? If yes, take out the $ at the end of the regex. If no, put a ^ at the beginning of the regex ($ matches end-of-string, ^ matches beginning-of-string).

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

Sidebar

Related Questions

I'm having trouble solving this problem: Create a function that given a character set
I'm having trouble solving this problem. I have to find all simple paths starting
I am having trouble picking the best data structure for solving a problem. The
I have a rather unique problem that I'm having trouble solving. I have a
I'm having some trouble solving the problem below (My thinking on how I might
I'm having trouble solving a problem with iterative SQL queries ( which I need
Having trouble when trying to create a class using another class(and 2 inner classes),
I'm having trouble solving a simple maths problem. My algebra skills are pretty embaressing.
I am new to jQuery, so I'm having trouble solving this. I want this
There is a big design flaw here, but I'm having trouble solving it: The

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.