JavaScript Regex Split Tester
Enter a separator pattern and see what text.split(regex) returns. Your text stays in this browser.
What the split array contains
- A trailing separator leaves an empty field
"one,two,".split(/,/) → ["one","two",""]- Capturing parentheses preserve the separator
"one,two".split(/(,)/) → ["one",",","two"]- The Unicode flag keeps code points together
"A🌱B".split(/(?:)/u) → ["A","🌱","B"]
An unmatched capture is undefined in JavaScript and appears as null in the copied JSON.