$30 off During Our Annual Pro Sale. View Details »

Regular Expressions Basics Lesson for Ada Academy

Avatar for nellshamrell nellshamrell
September 26, 2014

Regular Expressions Basics Lesson for Ada Academy

Avatar for nellshamrell

nellshamrell

September 26, 2014
Tweet

Other Decks in Technology

Transcript

  1. =~

  2. string = “The force will be with you always.” m

    = /force/.match(string) => #<MatchData “force” >
  3. string = “Renee is presenting to the class right now.

    Renee is presenting on regular expressions.”
  4. string = “Renee is presenting to the class right now.

    Renee is presenting on regular expressions.”
  5. string = “Renee is presenting to the class right now.

    Renee is presenting on regular expressions.” new = string.sub(/Renee/, “Nell”)
  6. new = string.sub(/Renee/, “Nell”) => “Nell is presenting to the

    class right now. Renee is presenting on regular expressions.”
  7. => “Nell is presenting to the class right now. Nell

    is presenting on regular expressions.” new = string.gsub(/Renee/, “Nell”)