Toggle navigation menu
OpenNTF Snippets
Other Sites
OpenNTF
Collaboration Today
XPages.info
Anonymous
Login
Back
Use Regex with JavaScript split()
You have to login first to use 'My Favorites' feature
So far, no one has added to favorites
Language
JavaScript (Server)
Tags
Author
Ulrich Krause
Submitted on
September 11, 2012 at 5:32 AM
Rating
Downloads
10
Notes
I you have a string that, for whatever reason, is concatenated using different delimiters, you can use regexp with javascript split() to build an array of single values.
Select XSnippet to copy to Clipboard
Embed XSnippet
Report
var s = "one#two#three~four~five"; s.split(/[#~]+/);
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the
Apache License Version 2.0
. See
Terms of Use
for full details.
No comments yet
Login first to comment...
Toggle navigation menu
Hosted by OpenNTF
Terms of Use
Privacy Policy
Contact OpenNTF
Follow OpenNTF
Follow Snippets