Use RegExp-literals, a look-ahead and [A-Z]
:
console.log(
// -> "Hi My Name Is Bob"
window.prompt('input string:', "HiMyNameIsBob").split(/(?=[A-Z])/).join(" ")
)
More Related Contents:
- Javascript Array – Split string at numbers [closed]
- How do I split a string with multiple separators in JavaScript?
- How can I parse a CSV string with JavaScript, which contains comma in data?
- Split large string in n-size chunks in JavaScript
- javascript regex split produces too many items
- Javascript split string on space or on quotes to array
- Javascript split regex question
- Split a string based on multiple delimiters
- javascript split string by space, but ignore space in quotes (notice not to split by the colon too)
- Javascript: Splitting a string by comma but ignoring commas in quotes
- How do you split a javascript string by spaces and punctuation?
- Regex – To allow numeric, only characters R, N, X, B, @ [closed]
- Regex for Email Address along with name format [duplicate]
- Negative lookbehind equivalent in JavaScript
- JavaScript regex multiline text between two tags
- Case insensitive regex in JavaScript
- I want to remove double quotes from a String
- Count number of matches of a regex in Javascript
- Replace a Regex capture group with uppercase in Javascript
- Regular Expression | Leap Years and More
- Javascript Regex to replace text NOT in html attributes [duplicate]
- Javascript – Regex to validate date format [duplicate]
- JavaScript Regex Global Match Groups
- What does the regular expression /_/g mean?
- Interesting test of Javascript RegExp [duplicate]
- Javascript Regex to match only a single occurrence no more or less
- Highlight current page in jquery
- Highlight word in HTML text (but not markup)
- Check if string contains only letters in javascript
- Regex – Repeating Capturing Group