Use regular expression /{(.*?)}/g
:
var re = new RegExp('{(.*?)}', 'g');
result = re.exec('QUO-{MM/YYYY}-{SERVICEGROUP}');
Will output: ["{MM/YYYY}", "MM/YYYY"]
Edit:
'QUO-{MM/YYYY}-{SERVICEGROUP}'.match(/{(.*?)}/g);
Will output: ["{MM/YYYY}", "{SERVICEGROUP}"]
More Related Contents:
- Javascript: Decimals still being allowed in regex check for numbers [duplicate]
- When should I use curly braces for ES6 import?
- Get the Highlighted/Selected text
- Remove Object from Array using JavaScript
- How to get a JavaScript object’s class?
- 5xx or 4xx error with “No ‘Access-Control-Allow-Origin’ header is present”
- Javascript : Send JSON Object with Ajax?
- Browser Timeouts
- Best practice for using window.onload
- Set attribute without value
- Why are certain function calls termed “illegal invocations” in JavaScript?
- How to convert unordered list into nicely styled dropdown using jquery?
- Adding div element to body or document in JavaScript
- Call js-function using JQuery timer
- “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error for response from http://www.google.com/
- regex to get the number from the end of a string
- Why do we need both client side and server side validation? [closed]
- With form validation: why onsubmit=”return functionname()” instead of onsubmit=”functionname()”?
- change background image in body
- Count instances of string in an array
- Uncaught TypeError: lang is not a function [duplicate]
- Javascript document.cookie always returns empty string
- Discord.js v13 code breaks when upgrading to v14
- What is Angular 4 and from where I can learn more about it?
- How to resize then crop an image with canvas
- Should JSON include null values [closed]
- Parsing JSON containing new line characters [duplicate]
- Group javascript array object by same key
- Find last index of element inside array by certain condition
- Is it possible, in JavaScript, to detect when the screen is turned off in the Android & iOS browsers