I am new to regex expressions. I want every word in string between two character. have already tried followings Stack Questions:
but nothing working for me i am missing something for sure. but confused what.
Suppose a "string": /path/__mutation/module1/__resolver/module2
Get directories between character: "__" and "/" // console.log() => [mutation, resolver]
But trying above two questions anwser to construct something which can get all special directories like mutation, resolver in over path.
Following are what i have tried.
var __path = /path/__mutation/module1/__resolver/module2
1. console.log(__path.match(/__(.*)?\//g))
// [ '__mutation/login/withMobileNumber/' ]
// [ '__mutation/register/withMobileNumber/' ]
// [ '__mutation/raw/__mutation/register/__resolver/rock/' ]
2. console.log(__path.match(new RegExp(`__` + '(.*)' + `/`)))
// null
consider `Template_String` as variable with those symbols
...