Git Product home page Git Product logo

python-p3-regex-lab's Introduction

RegEx Lab

Learning Goals

  • Validate that strings match specific patterns using regular expressions.
  • Search for strings that match specific patterns using regular expressions.

Key Vocab

  • Regular Expression: a sequence of characters used to search for a pattern inside of a string.
  • Pattern: a description of sequences of characters that share certain traits with one another. Sequences do not need to be the same length or share any common characters to pattern match. Also called a filter.

Instructions

This is a test-driven lab. Run pipenv install to create your virtual environment and pipenv shell to enter the virtual environment. Then run pytest -x to run your tests. Use these instructions and pytest's error messages to complete your work in regex.py in the lib folder.

This lab is meant to give you experience with writing patterns for regular expressions and using the re module to check your pattern against different strings. Use regex101 to test your pattern as you work through the different strings.

  • Run pytest -x to execute the first test. This will check your RegEx against the string "It's such a lovely day today."
  • Once you've compiled a regular expression that matches this first string, run pytest -x again to check against the next string in line.
  • Your RegEx should match all of the strings in the test file!
  • The last test uses the findall() method to search for these three strings in a list. You can check for this list in testing/regex_test.py.
    • If you hacked your way through the first three with r".*", you'll get caught here!

Once all of your tests are passing, commit and push your work using git to submit.


Resources

python-p3-regex-lab's People

Contributors

professor-ben avatar

Watchers

 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.