You can do it with regular expressions like this:
link = "<a href=\"http://localhost:5000/confirm/SFMyNTY.g3QAAAACZAAEZGF0YWIAAAsMZAAGc2lnbmVkbgYASDp-jVwB.HqUsytlpKq7h9qEQyjABS1Xv4sgwNFClB-asLYUGfyA\">Potwierdź swoje konto.</a>"
[[_, token]] = Regex.scan(~r/confirm\/(.*?)"/, link)
IO.puts token
Output:
SFMyNTY.g3QAAAACZAAEZGF0YWIAAAsMZAAGc2lnbmVkbgYASDp-jVwB.HqUsytlpKq7h9qEQyjABS1Xv4sgwNFClB-asLYUGfyA
This will work as long as your HTML structure remains exactly the same. Regex cannot parse arbitrary HTML, as you probably know already.