Find characters up to first occurrence of '\' in string rails : I'm still quite new to regex and can't find a similar question to what I am looking for. 

So I have a string with emails/numbers that is separated by \

    string = "test@test.com\test@gmail.com\12345678\"

What I am trying to do is get the first full email or number at the beginning of the string. I have been trying to do index of the first \ or match but am not getting the regex right. 

If:

    string = "test@test.com\test@gmail.com\12345678\"
    result = "test@test.com"

Or:

    string = "1236784464\test@test.com\test@gmail.com\12345678\"
    result = "1236784464"

Any help would be appreciated. 
