title: Format input data with regex in AngularJS
body: <p>I have some data in the following format. With the use of regex I want to display only the first two tokens.</p>
  
  <p>For example <strong>AB.JKL</strong>.MNO.XYZ => AB.JKL</p>
  
  <pre><code>AB.JKL.MNO.XYZ
  KJ.KJLJ.KD.IUOI
  KLJ.LK.LJ.JL.OLJ.JLL
  </code></pre>
  
  <p>Note: I am using AngularJS I can achieve this using Angularjs expression directly in the html but the html is a common template where other data is also being displayed I don't want to corrupt it. Therefore I want to apply regex on data in controller.</p>