From: "Jesús Gabriel y Galán" Date: 2010-10-28T18:08:36+09:00 Subject: Re: Word starts by a vowel On Thu, Oct 28, 2010 at 10:49 AM, Greg Ma wrote: > Hi, > How could I know if a word starts by a vowel? > I couln't find it online and I am a real nooby with regex... For this kind of task, you use a regex with a character class that contains the valid characters you want to check. You also need to anchor it at the start of the string to match only that position (or try to match only the first character): irb(main):001:0> "asdfsifnweif" =~ /\A[aeiou]/ => 0 irb(main):002:0> "vfvdasdfsifnweif" =~ /\A[aeiou]/ => nil irb(main):005:0> "asdfsifnweif"[0,1] =~ /[aeiou]/ => 0 irb(main):006:0> "vfvdasdfsifnweif"[0,1] =~ /[aeiou]/ Jesus.