Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var str = value.replace(/\s+/g, " ");
- if (str.match(/^\S+\s\S+$/g)){
- var re = /^(\S+)\s+/;
- str.replace(re, "$1\r");
- };
- else if (str.match(/^\S+\s\S+\s\S+$/g)){
- var re = /^(\S+)\s/;
- str.replace(re, "$1\r");
- }
- else if (str.match(/^\S+\s\S+\s\S+\s\S+$/g)){
- var re = /^(\S+\s\S+)\s/;
- str.replace(re, "$1\r");
- };
Add Comment
Please, Sign In to add comment