You probably meant “rather than a straight regex.” Well, it depends . In most cases Regex is just fine. Also, if you are after parsing the (contrived example) ISO8601 representation of a date, you might extract year, month and day straight away:
<<
year :: binary-size(4), "-",
month :: binary-size(2), "-",
day :: binary-size(2)>> = "2019-03-20"
year
#⇒ "2019"
There is no silver bullet.


















