Tutorial 9 : Regular Expressions in Python-modifying strings in regex
Missed previous tutorial ? — Click here
In this tutorial we shall be discussing about modifying the strings using different methods in regex.
1. sub() method :
This method is used to substitute or replace the matching string with other string.
2. subn() method :
This method does the same thing as sub(), but returns the new string and the number of replacements as a tuple.
3. split() method :
This method is used to split the string into a list, splitting it wherever the regex-pattern matches.
Congratulations !! You completed this tutorial series.
You came to the end of this regex tutorials. I hope you managed to get decent understanding of what regex is and how regex works.
If you like these tutorials and want me to cover other topics then do let me know in the comment box.
Happy learning !!!