Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Introduction to Regular
Expressions
programcreek.com
Agenda
1. Definition of Regular Expressions
2. Some Special Characters Used in Regular
Expressions and Exercises
Search a Single Word
How to find “ride” in a Word document?
Just type “ride” and click search!
Search Multiple Words
1) “ride” and “rode”?
Use a Regular expression!
“r.de” “r.de.?”
2) “ride”, “rode”, “rider”, “rides”?
Definition
A Regular Expression is a sequence of
characters that forms a search pattern.
1) It is a pattern for searching....
More Complicated Tasks
● Finding ALL email addresses in a doc.
● Data Validation
Agenda
1. Definition of Regular Expressions
2. Some Special Characters Used in Regular
Expressions
Special Character “.”
“.” stands for “any character” by itself.
Example:
Exercise 1:
What does “the.e” match?
1. these
2. there
3. thee
Special Character “*”
“*” has to be used after some character, i.e., it
can not be used by itself.
“*” stands for “any num...
Exercise 2
What does “ad*vers.” match?
1. “averse”
2. “adverse”
3. “adverb”
Special Character “?”
“?” has to be used after some character.
“?” stands for “at most one character”
Example:
Exercise 3
What does “Hn*ell?o W...d” match?
1. “Hello World”
2. “Hello Wood”
3. “Hnelo World”
Special Character - “{n,m}”
{n,m} stands for “at least n times, at most m
times”
Example:
Questions?
Upcoming SlideShare
Loading in …5
×

8 Min Introduction of Regular express

3,896 views

Published on

  • Be the first to comment

  • Be the first to like this

8 Min Introduction of Regular express

  1. 1. Introduction to Regular Expressions programcreek.com
  2. 2. Agenda 1. Definition of Regular Expressions 2. Some Special Characters Used in Regular Expressions and Exercises
  3. 3. Search a Single Word How to find “ride” in a Word document? Just type “ride” and click search!
  4. 4. Search Multiple Words 1) “ride” and “rode”? Use a Regular expression! “r.de” “r.de.?” 2) “ride”, “rode”, “rider”, “rides”?
  5. 5. Definition A Regular Expression is a sequence of characters that forms a search pattern. 1) It is a pattern for searching. 2) It contains a sequence of characters. (letters + special characters)
  6. 6. More Complicated Tasks ● Finding ALL email addresses in a doc. ● Data Validation
  7. 7. Agenda 1. Definition of Regular Expressions 2. Some Special Characters Used in Regular Expressions
  8. 8. Special Character “.” “.” stands for “any character” by itself. Example:
  9. 9. Exercise 1: What does “the.e” match? 1. these 2. there 3. thee
  10. 10. Special Character “*” “*” has to be used after some character, i.e., it can not be used by itself. “*” stands for “any number of characters” Example:
  11. 11. Exercise 2 What does “ad*vers.” match? 1. “averse” 2. “adverse” 3. “adverb”
  12. 12. Special Character “?” “?” has to be used after some character. “?” stands for “at most one character” Example:
  13. 13. Exercise 3 What does “Hn*ell?o W...d” match? 1. “Hello World” 2. “Hello Wood” 3. “Hnelo World”
  14. 14. Special Character - “{n,m}” {n,m} stands for “at least n times, at most m times” Example:
  15. 15. Questions?

×