Giter Site home page Giter Site logo

wdi_10_regex_lab's Introduction

General Assembly Logo

Ruby Regex Lab

Regex (regular expressions) are a special datatype in Ruby that allows you to declare a pattern that can be used to match other objects like strings. This is an example of declarative programming that we talked about earlier in the week, because you're just specifying the results that you'd like to see, not telling the computer how to do it.

Assignment

Fork/clone this repo. In the end, do a pull request (PR) to turn in the assignment.

Run bundle install from the terminal in this folder to ensure that you have the proper Gems installed.

  • Use @source_text as your data source for extracting data. Do not edit this file.
  • Extract all valid IP addresses into an array returning from the valid_ip_addresses method
    • (format for valid IP address is xxx.xxx.xxx.xxx)
  • Extract all valid IP addresses from MIT into an array returning from the valid_mit_ip_addresses method
    • (format 18.xxx.xxx.xxx)
  • From this data, create an array of non-MIT IP addresses from the non_mit_ip_addresses method
  • Extract unique valid US phone numbers into an array returning from the valid_phone_numbers method
  • Extract the valid area code into an array returning from the area_codes method.
    • (US area codes cannot begin with 0 or 1)
  • Extract the email addresses into an array returning from the email_addresses method.
  • Extract the valid zip codes into an array returning from the zip_codes method.
  • Extract the valid hex colors into an array returning from the hex_colors method.

Run rspec spec to check if your main.rb has the right results.

Resources

Quick blog post on Regexes:

http://www.joshondesign.com/2011/04/12/joshs-quick-intro-to-regex/

Rubular - an awesome real-time regex editor for Ruby

http://rubular.com/

RegExr - another regex editor, rollover an expression or match to see a detailed explanation

http://www.regexr.com/

wdi_10_regex_lab's People

Contributors

trinityxmontoya avatar tibbon avatar

Watchers

Matthew McDevitt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.