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

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -