# Regular Expressions in Natural Language Processing

##  Regular Expressions in Natural Language Processing

Regular Expressions is very popular among programmers and can be applied in many programming languages like Java, JS, php, C++, etc.

Regular Expressions are used in various tasks such as data pre-processing,  rule-based information mining systems,  pattern matching,   text feature engineering,   web scraping,   data extraction, etc.

## Python Built-in Module for Regular Expressions
Python has a built-in module to work with regular expressions called “re”. Some common methods from this module are-
•	re.match()
•	re.search()
•	re.findall()

# Let us look at each method with the help of an example-
1. re.match(pattern, string)
The re. match function returns a match object on success and none on failure.

 
2. re.search(pattern, string)
Matches the first occurrence of a pattern in the entire string(and not just at the beginning).
 
3. re.findall(pattern, string)
It will return all the occurrences of the pattern from the string. I would recommend you to use re.findall() always, it can work like both re.search() and re.match().
 



