title: Format a string using regex in Java
body: <p>Is there any way I can format a string into a specific pattern using regex or is stringbuilder + substring a faster approach?</p>
  
  <p>For example, say a phone number --> 1234567890 as input</p>
  
  <p>And get output as --> (123) 456-7890</p>
  
  <p>I saw it is possible on this article : <a href="https://web.archive.org/web/20211020111604/https://www.4guysfromrolla.com/webtech/031302-1.shtml" rel="noreferrer">https://web.archive.org/web/20211020111604/https://www.4guysfromrolla.com/webtech/031302-1.shtml</a> but the given explanation is in ASP. How do I do it in Java ???</p>