On 5/21/07, vamsi <[EMAIL PROTECTED]> wrote: > Hi, > > > Can any one please tell me how to extract the last word from one senetence > using watir scripting? > > Example: Sentence: What is your name? > My answer is : name > > so i need to extract the name from the above sentence. can any one please > help me to resolve this problem?
Read about "regular expressions": ########################### data = 'What is your name' #with split() words = data.split(/\s+/) puts words.last puts words.first #with pure regexp data =~ /\w+$/ puts $& _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
