javascript regex split
Is it possible to split a string twice with regex? For example, say I have the string:
开发者_Go百科example=email@address.com|fname|lname
how can I split to the result is:
email@address.com,fname,lname
thanks...
You can manually remove the prefix:
str.substr(str.indexOf('=') + 1)
.split('|')
How about this?
var result=myString.split("=", 2)[1].split("|");
You want to search and replace the '|' to ' , '.
Why dont you use replace()
http://www.w3schools.com/jsref/jsref_replace.asp
精彩评论