The sample string is =aa=bb=cc=dd=.
I tried
string.match(/=(\w*)=/)
but that returns only aa.
How do I find aa, bb, cc and dd from the sample string?
This regex will match explicitly your requirements, and put the non, delimiter portion it the first capture group:
=([^=]+)(?==)
Unfortunately JavaScript regex does not have look behinds, otherwise this could be done in much easier fashion.
Here is some code:
var str = '=([^=]+)(?==)';
var re = /=([^=]+)(?==)/g,
    ary = [],
    match;
while (match = re.exec(str)) {
    ary.push(match[1]);
}
console.log(ary);
                        var values = yourString.split('='); You'll get an array with all your required values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With