Quantcast
Channel: Ivy Professional School | Official Blog
Viewing all articles
Browse latest Browse all 330

Step by Step Guide of Python Regular Expressions – Part 1

$
0
0

The very first article in the NLP series introduced Natural Language Processing. We then explained String Operations that can be performed on text using Python. Further, in the quest to strengthen our text pre-processing, we must have a good understanding of Regular Expressions. This article is the first part of a step by step guide of Python Regular expressions. What is Regular Expression? Regular Expressions, also called Reg Exs, are a special sequence of characters often denoted using the raw string notation. Reg Ex helps create string patterns and use them for searching and substituting specific pattern matches in textual data. Many other programming languages like Java, Perl, Unix also support regular expression functionality. Why do we need Regular expression? It is pertinent if you are wondering what is the need for regular expressions. In our previous article, we explained several basic string operations like split, join, strip, etc. Should not these suffice? Let us look at the below scenarios before answering this question. Consider a sample text – “N123tur123l l123ngu123ge Processing”. We want to replace the string ‘123’ with ‘a’. A simple string operation code to achieve the task looks like this. string_sample = "N123tur123l l123ngu123ge Processing" string_sample.replace("123","a") Replaced. […]

The post Step by Step Guide of Python Regular Expressions – Part 1 appeared first on Ivy Professional School | Official Blog.


Viewing all articles
Browse latest Browse all 330

Trending Articles