Most likely the @dystroys answer is the one you are looking for. But if any characters other than alphanumeric characters ( AZ , AZ , 0-9 or _ ) can surround "splitting = "), then its solution will not work. For example, the line
It's=risqué=to=use =Unicode!=See?
will be broken down into
"It's", "risqué=to", "use Unicode!=See?"
So, if you need to avoid this, you will usually use the lookbehind statement:
result = subject.split(/(?<!=)=(?!=)/);
So, although this will only be split into one = s, you won’t be able to use it because JavaScript does not support the statement (?<!...) lookbehind.
Fortunately, you can always convert a split() operation to a global match() operation, matching everything that is allowed between the delimiters:
result = subject.match(/(?:={2,}|[^=])*/g);
will provide you
"It's", "risqué", "to", "use ", "Unicode!", "See?"
source share