Pattern matching; Regex; Need to replace everything after the second match

Posted by Davis on Stack Overflow See other posts from Stack Overflow or by Davis
Published on 2010-04-02T04:37:07Z Indexed on 2010/04/02 4:43 UTC
Read the original article Hit count: 330

Ok so if I have this pattern:

ab&bc&cd&de&ef

And I need to replace all the ampersands except for the first one with commas so it ends up looking like this:

ab&bc,cd,de,ef

Its probably very simple but for the life of me I can't get this one figured out...

© Stack Overflow or respective owner

Related posts about regex

Related posts about JavaScript