Matching the Fields of a Record

Let’s learn how to match the fields of a record using regular expressions in Go.

We'll cover the following

This example takes a different approach as we read an entire record and split it prior to doing any checking. Additionally, we make an extra check to make sure that the record we are processing contains the right number of fields. Each record should contain three fields: name, surname, and telephone number.

Coding example

The function that supports the desired functionality (defined in the fieldsRE.go) is implemented as follows:

Get hands-on with 1200+ tech skills courses.