ruby - Splitting at Space Between Letter and Digit -
i'm having worst time simple regex.
example input:
cleveland indians 5, boston redsox 4
i'm trying split @ ,
, space between letter , number
example output:
cleveland indians 5 boston redsox 4
here have far, it's including number still.
/,|\s[0-9]/
string = "cleveland indians 5, boston redsox 4" string.split /,\s*|\s(?=\d)/ # => ["cleveland indians", "5", "boston redsox", "4"]
\s(?=\d)
: space followed digit using lookahead.
Comments
Post a Comment