From: Nuralanur@... Date: 2006-06-01T19:34:11+09:00 Subject: Re: How I can check number? -------------------------------1149158032 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable =20 In einer eMail vom 01.06.2006 12:21:49 Westeurop=E4ische Normalzeit schreibt= =20 iiskakov@gmail.com: How I can simplify it: params[:value] =3D~ /^\d+$|^-\d+$|^\d+\.\d+$|^-\d+\.\d+$/ OK, so, you want to extract the numbers that can by either floats or =20 integers from some text. You can use a * after something you don't necessarily need in your Regexp, =20 and you can use that on groups of characters, enclosed in brackets: =20 =20 text=3D'my bank account is -100000000.09 dollars, but I earn 1 dollar a day= ,=20 which is better than earning 0.50 dollars or 0 dollars.' words=3Dtext.split numbers=3D[] words.each{|x| if x=3D~ /^\-*\d+(\.\d+)*$/ numbers<