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.
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).