Str.split() Pass Muliple Delimeter One Regular Expression And Another String
Well I am using var str.split() in javascript to pass multiple delimeter where one is regular express and another is string where regular expression is /\([0-9]\)/ and string is Ex
Solution 1:
Is this works for you ? You can add exception string with decimal delimeter as:
str = str.replace(/(\(\d+\)|exception\s*\:)/gi, "<br /><br />$1");
Let me know, if i am getting you right and you get your answer.
Solution 2:
You can use lookahead for that. You don't really want to split on the parenthesized numbers, but on whitespaces that are followed by the beginning of the new paragraph (i.e. numbers or "Exception").
var parts = str.split(/\s+(?=\(\d+\)|Exception)/g),
val = parts.join("\n\n"); // or something
Post a Comment for "Str.split() Pass Muliple Delimeter One Regular Expression And Another String"