Regexp string search

Hi All,
I am doing a codewar cata and i want to match only the numbers but exclude alphanumerics.

Boston Celtics 112 Philadelphia 76ers 95

r := regexp.MustCompile([0-9]+)

Thanks in Advance

got the solution


but you are not excluding “numerics”, are you? Only “alphas” and spaces.

thanks for reply
from this string Boston Celtics 112 Philadelphia 76ers 95 i was trying to get only 112 & 95
and exclude 76ers

still new to regex but i came up with this [^a-zA-Z\s]+\b which eliminates all alphas and alphanumeric left with numeric

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.