0

Is it possible to split a string twice with regex? For example, say I have the string:

[email protected]|fname|lname

how can I split to the result is:

[email protected],fname,lname

thanks...

3 Answers 3

5

You can manually remove the prefix:

str.substr(str.indexOf('=') + 1)
   .split('|')
Sign up to request clarification or add additional context in comments.

Comments

1

How about this?

var result=myString.split("=", 2)[1].split("|");

Comments

0

You want to search and replace the '|' to ' , '.

Why dont you use replace()

http://www.w3schools.com/jsref/jsref_replace.asp

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.