This produces your desired output
regex("[:alpha:]+[:digit:]+[:alpha:]+[_][:digit:]+|[:alpha:]+[:digit:]+[_][:alpha:]+|[:alpha:]+[:digit:]+")
Note: Do not use new lines in your regex unless you actually want to match one, if you want to use new lines (but not match them) use comments = TRUE
option.