+ 4

[SOLVED]What is the re module used for in python?

15th Aug 2018, 5:25 PM
LONGTIE👔
LONGTIE👔 - avatar
9 Respuestas
+ 4
regex operations. finding patterns etc .
15th Aug 2018, 5:40 PM
Markus Kaleton
Markus Kaleton - avatar
+ 6
Markus Kaleton that's all it does? ok
15th Aug 2018, 5:47 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 5
Jordan oh cool!
15th Aug 2018, 6:15 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 5
Jordan can you help me with one of my python codes?
15th Aug 2018, 6:24 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 1
You could almost say regex is a programming language by itself. really useful. More to read: https://docs.python.org/3/howto/regex.html + re module docs
15th Aug 2018, 5:49 PM
Markus Kaleton
Markus Kaleton - avatar
+ 1
You can use it to process strings. I've seen it described as ctr + f on steroids. Except you can customize exactly what, how, and where to look for it.
15th Aug 2018, 6:14 PM
Jordan
Jordan - avatar
+ 1
For example I use it in my chess engine (current version not yet posted here) to analyze the notation for a move. It validates that the note is of the proper format, then uses the various parts of it to construct a Move object based on the information provided. I believe I also use it when making new Piece objects. I just pass a string to the Player class and it pulls it apart, identifies the type of Piece to create and the position to create it at.
15th Aug 2018, 6:23 PM
Jordan
Jordan - avatar
+ 1
LONGTIE Sure, what'cha got?
15th Aug 2018, 6:25 PM
Jordan
Jordan - avatar