The Regex functions are useful for changing the format of existing strings, for example, suppose you want to display Phone no in (ddd) ddd-dddd format instead of ddd-ddd-dddd. To do this, Right click on the required textbox --> click expression... and enter below expression:
=System.Text.RegularExpressions.Regex.Replace("301-222-6666", "(\d{3})[ -.]*(\d{3})[ -.]*(\d{4})", "($1) $2-$3")
Output : (301) 222-6666
Published under: SQL Server Tips · · · ·