So I have this string:
sockcooker!~shaz@Rizon-AC7BDF2F.dynamic.dsl.as9105.com !~shaz@ PRIVMSG #Rizon :ohai. New here. registered 10 mins ago, have not got an ema
You want to use an ungreedy match. There are two ways (and python supports both). The latter is more flexible:
r"![^@]+" r"!.+?@
The ? makes the .+ ungreedy, so it will stop at the first "@" instead of the last.
?
.+