I have string like this {employee name}
some text {employee designation}
some text {practice}
some text {from date}
to {to date}
{from date}
I want employee name,employee designation,practice and so how to do this in javascript
Asked
Active
Viewed 73 times
-2

Equalsk
- 7,954
- 2
- 41
- 67
-
2Can you show your effort by putting sample code? Try to parse yourself first, also include [mcve]. – Tetsuya Yamamoto Oct 13 '17 at 07:20
-
1Possible duplicate of [How to get text between two characters?](https://stackoverflow.com/questions/7365575/how-to-get-text-between-two-characters) – Equalsk Oct 13 '17 at 07:20
-
you can use string.match for this – enno.void Oct 13 '17 at 07:21
-
Possible duplicate of [JavaScript equivalent to printf/string.format](https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format) – ASpirin Oct 13 '17 at 07:21
1 Answers
0
you can use substring
to get the characters in between the braces
something like:
var s='{test}';
var res = s.substring(1, s.length-1);
alert(res);//this will alert test

Nishad K Ahamed
- 1,374
- 15
- 25
-
OP is just asking this : How to Extract String between two braces - javascript – Nishad K Ahamed Oct 13 '17 at 07:36
-
You don't need a regular expression for this; firing up the regex engine is completely overkill for such a simple task – Nishad K Ahamed Oct 13 '17 at 09:03