Added a regex capturing function