Regular Expressions in Python

Invite Friends
Facebook Twitter Google+ LinkedIn Email
Description
Virtual Practice Lab
Practice Test
Resources
Regular Expressions in Python

Regular Expressions in Python

This lesson covers Regular Expressions (re) in Python. Regular Expressions in Python are accomplished via the ‘re’ module and consist of two types of characters:

  • Ordinary: (A, a, B, b)
  • Special: “.”, “*”, ‘?”

An example of an expression in Python is /d{3}-/d{3}-/d{4}. This is a pattern which can be used to find an American phone number and consists of special characters, specifies how many of a character we are looking for.

Participants also learn about Regular Expression (re) methods and Match Objects Methods:

  • compile: turns the pattern into something the regex engine can understand
  • search: scans a string for the pattern and returns to a MatchObject for the first match
  • match: only checks the beginning of the string for the pattern
  • object.group: returns subgroups of a Match Object
  • strt/reobject.end: return the string indices at which the match starts and ends
  • re: contains the regex pattern matched

This lesson also covers multithreading, which can increase speed, among its other advantages, however a disadvantage is that it’s harder to track down errors over multiple threats. Finally, participants also learn about a mutex (mutually exclusive) lock which is a means of controlling access to a resource.

Coming Soon
Learn on the go.
The app designed for the modern cyber security professional.
Get it on Google PlayGet it on the App Store
Practice Labs and Exam Vouchers

Congratulations! You're taking the first step to getting certified. Get some hands on experience with available practice labs OR save some money, support Cybrary, and purchase discounted exam vouchers. Ready to earn your next industry certification? Join cyber security's largest community and start learning today.

JOIN CYBRARY

Upcoming Industry Events

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 

Cybrary|0P3N

UNM4SK3D: WPA2, ATMs, and RSA Keys
Views: 503 / October 20, 2017
New Attack Against WPA2 “KRACK”
Views: 891 / October 20, 2017
How To Be Security Conscious
Views: 1174 / October 19, 2017
External IP Address Search Using Python Source Code
Views: 2469 / October 18, 2017
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel