Skip to content

Latest commit

 

History

History
 
 

0x06-regular_expressions

0x06. Regular expression

A regular expression, commonly called a “regexp”, is a sequence of characters that define a search pattern. It is mainly for use in pattern matching with strings, or string matching (i.e. it operates like a “find and replace” command). While it is a very powerful tool, it is also very dangerous because of its complexity.

More about regexp:

Exercises

0. Simply matching Holberton

Requirements:

The regular expression must match Holberton Using the project instructions, create a Ruby script that accepts one argument and pass it to a regular expression matching method

1. Repetition Token #0

Requirements:

Find the regular expression that will match the above cases Using the project instructions, create a Ruby script that accepts one argument and pass it to a regular expression matching method

2. Repetition Token #1

Requirements:

Find the regular expression that will match the above cases Using the project instructions, create a Ruby script that accepts one argument and pass it to a regular expression matching method

3. Repetition Token #2

Requirements:

Find the regular expression that will match the above cases Using the project instructions, create a Ruby script that accepts one argument and pass it to a regular expression matching method

4. Repetition Token #3

Requirements:

Find the regular expression that will match the above cases Using the project instructions, create a Ruby script that accepts one argument and pass it to a regular expression matching method

5. Not quite HBTN yet

Requirements:

  • The regular expression must be exactly matching a string that starts by h ends by n and can have any single character in between

  • Using the project instructions, create a Ruby script that accepts one argument and pass it to a regular expression matching method

6. Call me maybe

This task is brought to you by Holberton mentor Neha Jain, Senior Software Engineer at LinkedIn.

Requirement:

  • The regular expression must match a 10 digit phone number

7. OMG WHY ARE YOU SHOUTING?

Requirement:

  • The regular expression must be only matching: capital letters