From: Paul Danese Date: 2007-04-20T23:46:25+09:00 Subject: splitting a string into words using multiple possible separators ------_=_NextPart_001_01C7835A.83B6F5A8 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 I'm using ruby 1.8.5 =20 i have an input string whose 'words' are separated by whitespace and/or commas and/or semicolons =20 I want to remove the separators (,;\s) and place each 'word' into an array =20 e.g., =20 this string =3D> 'my uncle, jumped over;=20 the moon' =20 would be converted into an array of elements ['my', 'uncle', 'jumped', 'over', 'the', 'moon'] =20 =20 currently, i'm doing this (in this example, rx_input holds the string and rx_numbers is the array): =20 rx_input.gsub!(/[,;\s]/, ' ') rx_input.squeeze!(' ') rx_numbers =3D rx_input.split(' ') =20 is there a simpler /more elegant/ way of doing this (accounting for the possibility of double-spaces, etc)? =20 tia ------_=_NextPart_001_01C7835A.83B6F5A8--