A Regular Expression (regex) is nothing but a finite state machine (FSM).
An FSM attempts to answer the question "Is this state possible or not?"
It keeps attempting to make a pattern match until a match is found (success), or until all paths are explored and no match was found (failure).
On success, the question "Is this state possible or not?" has been answered with a "yes". Hence no further matching is necessary and the regex returns.
Further: here is an interesting example to demonstrate how regex works. Here, a regex is used to detect if a give number is prime. This example is in perl, but it can as well be written in ruby.
"foo+account2@gmail.com"[/\+([^@]+)/, 1] # matches capture group 1, i.e. what is inside ()
# => "account2"
"foo+account2@gmail.com"[/\+([^@]+)/] # matches capture group 0, i.e. the whole match
# => "+account2"