> Can Anyone help me with regular expression which checks the string, if > it contains Leading whitespaces. > example > => admin > it contains leading space with it. > so i need to check it. > pls help me.
Read up on the Regex class and pattern matching in general... str = " some string with a leading space" if str =~ /^\s/ puts "we have a leading space" else " puts "we don't" end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

