title: Text parsing and formatting with JavaScript
body: <p>I am working in an application where I am facing a problem while text formatting(bold, italics and underlined). I am making an array by splitting the whole text with #b#, #i# and #u#. But for few scenarios it is difficult to split like that. I am having another circumstances where I need to check the words like '%% word' to be separated also. Few examples are :</p>
  
  <pre><code>1. A #i#sample#/i# %%text #b#with%% text format#/b#
  2. %%#b#A#/b#%%|%%#b#B#/b#%% will be good.
  </code></pre>
  
  <p>In all case I need a array like the following -</p>
  
  <pre><code>["A"," ","&lt;i&gt;sample&lt;/i&gt;"," ","%%text&lt;b&gt;with&lt;/b&gt;%%"," ","&lt;b&gt;text format&lt;/b&gt;"]
  
  ["%%&lt;b&gt;A&lt;/b&gt;%%","|","%%&lt;b&gt;B&lt;/b&gt;%%"," ","will be good."] //Space excluded
  </code></pre>