Purpose of re module | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Purpose of re module

What is the purpose or application of re module?

3rd Mar 2017, 6:09 PM
AJESH KUMAR
AJESH KUMAR - avatar
6 Answers
+ 9
Basically, data mining. Parsing strings and picking valuable organized data, meeting certain logical crteria, from sets of characters :) But there are also other non-obvious applications, like checking if a number is prime: https://code.sololearn.com/cgEoWC8lFuCk/#py
3rd Mar 2017, 6:55 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 10
Here's an example of a few uses: https://code.sololearn.com/c40z8B7tOdCN/?ref=app Constructing a proper regex may require some practice. There's a cool interactive site for testing your queries on your text samples: www.regex101.com
12th Nov 2017, 7:25 AM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 8
re module is used in regular expressions. By importing re module regular expressions can be used.
12th Nov 2017, 3:42 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 8
https://docs.python.org/2/library/re.html
12th Nov 2017, 4:15 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
12th Nov 2017, 4:29 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 5
Can you show me an example to understand the purpose of it.
12th Nov 2017, 3:45 AM
AJESH KUMAR
AJESH KUMAR - avatar