javascript - Decompose a string using regex -
i need decompose string javascript.
the initial string:
$var="1234 => 4242,example mailbox,root@localhost"
the 4 decomposed parts:
1234 4242 example mailbox root@localhost
what more efficient way: use regular expression or call string functions?
can please provide regex extract such patterns, using groups.
here solution little less restrictive :
$var.split(/\s*,\s*|\s*=>\s*/)