-2

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

Equalsk
  • 7,954
  • 2
  • 41
  • 67
  • 2
    Can you show your effort by putting sample code? Try to parse yourself first, also include [mcve]. – Tetsuya Yamamoto Oct 13 '17 at 07:20
  • 1
    Possible 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 Answers1

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