Eddie Costa Domingues Eddie Costa Domingues - 2 years ago 96
Javascript Question

Javascript how to split() multiple string or values?

So for example I want to use the split() method on these characters

and the string that I'm going to split looks like this

wot wot
Answer Source

Do you want to remove those characters or split on those characters to form an array? Your question is confusing and you should consider re-phrasing it.

If you want to remove them:

console.log("{99}".replace(/[{}]/g, "")) /* "99" */

If you want to split on them:

console.log("{99}".split(/[{}]/g)) /* ["", "99", ""] */

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download