Cleaned up regular expression for linear pair formatting