Beginners - Learning Regular Expressions For Programmers

A Basic Introduction To Using Regular Expressions In Programming
3.7 (11 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
437 students enrolled
70% off
Take This Course
  • Lectures 36
  • Length 2 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 7/2013 English

Course Description

Regular expressions are a powerful tool that can help you to find, replace and format text quickly, but they have a reputation of being extremely hard to understand. In this Regular Expressions training course, this course de-mystifies the sometimes confusing and always-difficult world of Regular Expressions, putting a very powerful tool right at your fingertips.

You will learn how to create Regular Expressions step-by-step, removing the mystery of what the characters represent and how they work together. This training video uses real world scenarios as examples to help re-enforce the lessons. Mike shows you how to validate dates, phone numbers, URLs and emails, as well as how to search for, and correct misspelled words or other content. You will explore how to implement Regular Expressions in PHP, Java, C# and JavaScript.

This video based training course for Regular Expressions is an essential reference for beginner and experienced programmers alike. Once you have completed the tutorial videos, you will have a clear understanding of what Regular Expressions are, and how to use them to solve everyday content formatting problems. Working files are included, allowing you to follow along with the author throughout the lessons.

What are the requirements?

  • PC or Mac

What am I going to get from this course?

  • To Understand How To Use Regular Expressions In Most Programming Languages

Who is the target audience?

  • Web Developers
  • Programmers

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: 01. Introduction To Regular Expressions
Important - Working Files - Download These First
0101 Introduction Regular Expressions
0102 Installing Grep In Windows
0103 Search Strings With Grep
0104 Evaluating Regular Expressions Using Preg_Match In PHP
0105 Evaluating Regular Expressions Using Objects In JavaScript
0106 Evaluating Regular Expressions Using Patterns In C#
0107 Evaluating Regular Expressions Using Classes In Java
0108 Practice Exercise - Part 1
0109 Practice Exercise - Part 2
Section 2: 03. Matching Text
0201 Exploring Metacharacters Using Grep - Part 1
0202 Exploring Metacharacters Using Grep - Part 2
0203 Exploring Metacharacters Using Grep - Part 3
0204 Shortcuts With Metacharacters
0205 Email Validation With PHP
0206 Zip Code Validation With C#
0207 Creating Word Boundaries With Java
0208 Choosing Alternatives with JavaScript
Section 3: 02. Using Metacharacters
0301 Matching Text Using Grep - Part 1
0302 Matching Text Using Grep - Part 2
0303 Date Matching With PHP
0304 Time Matching With JavaScript
0305 Matching IP Addresses With C#
0306 Validating URLs Using Java
0307 Practice Exercise
Section 4: 04. Modifying Text
0401 Replacing Strings With Java
0402 Replacing Text with PHP
0403 Replacing Duplicate Words With C#
0404 Replacing Numbers Using JavaScript
0405 Practices Exercise
Section 5: 05. Advanced Uses For Regular Expressions
0501 The Split Function In Java
0502 Checking Passwords Using JavaScript
0503 Validating URLs With PHP
0504 Verifying A Windows Path With C#
0505 Practice Exercise
Section 6: 06. Wrap-up
0601 Wrapping Up With Regular Expressions

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Infinite Skills, High Quality Training

Infinite Skills is a Canadian based company who offer a huge and ever growing range of high quality eLearning solutions that teach using studio quality narrated videos backed-up with practical hands-on examples and comprehensive working files. All courses are created by trained educators and experts in video based education.

The emphasis is on teaching real life skills that are essential for progressing in today's commercial environment.

Ready to start learning?
Take This Course

How Regular Expressions Allowed
Text to Become Data

Ben Naval created a game to test your regular expressions prowess.

If your company's product is discussed on Twitter, how can you understand what millions of people are saying about it? If you are a politics wonk, how can you analyze the words politicians use in hundreds of speeches-like every single State of the Union address?

The term "data" brings to mind reams of numbers in a spreadsheet. For many, data connotes profit and loss statements, population numbers or baseball statistics. But to an increasing degree, the data that companies and researchers most want to analyze comes in the form of text.

To answer questions like those described above, researchers can now analyze text in completely novel ways. Along with the advent of modern computing, the development of regular expressions (or regex) has made it possible to work with text like data in a spreadsheet. While researchers have long been interested in text mining-the data processing and analysis of text-it used to be impossibly time consuming. Programming languages were not well equipped to work with text.

The emergence of regular expressions has enabled analysts to efficiently search for patterns in text and make sense of that information. This allows data scientists to understand the sentiment of tweets about a topic or product, social scientists to analyze political rhetoric, and anyone to make greater sense of our world.

Stephen Cole Kleene developed the foundational theory for regular expressions in the 1950s. Kleene is a father of modern computer science, and perhaps the most influential thinker about what makes for a "language" in mathematical terms. Though his work was abstract and philosophical, his theory of regular expressions led to a practical method of searching through text.

In the most basic terms, Kleene's insights led to language being symbolized mathematically. This made the ability to search through text documents on a computer dramatically more flexible and powerful.

Unlike numbers, text is messy. The word color, for example, can also be spelled colour. But with Kleene's symbols, a question mark placed inside a search can symbolize a term that includes zero or one of the preceding character. So "colou?r" means both "color" and "colour". The use of such symbols made it dramatically easier to search patterns in data.

Stephen Cole Kleene is the father of regular expressions and a giant of
computer science and mathematics.

A little more than a decade after Kleene elucidated his theory, legendary computer scientist Ken Thompson put regular expressions into practice. Thompson, then at Bell Labs, was the first to implement regular expressions within a text editor. This allowed data analysts and programmers to search for complex patterns within text. This proved incredibly useful, and the ability to use regular expression was soon implemented inside of all major programming languages.

These days, regular expressions are essential for working with text data. It is a tool used by data scientists and programmers alike for a variety of tasks.

Regular expressions help data scientists determine whether a set of text contains a certain pattern, and to fix data, like a misspelled name, that has been entered incorrectly. Regular expressions are also commonly used for web scraping. The html that makes up a web page is quite complicated, and the ability to parse that text with regular expressions makes it possible to collect information from web pages in a structured manner. The field of data journalism owes quite a debt to regex.

For programmers, one of the most common uses of regular expressions is validating emails, usernames and passwords. Usernames and passwords often have to be a certain length or include certain types of characters. Servers use regular expressions to check whether the text entered by a user is appropriate.

To demonstrate the power of regular expressions, we thought it would be illuminating to use them to analyze our own social media presence.

Every day, thousands of people tweet about their experience with Udemy. Though we can easily search for Udemy mentions on Twitter, it is more difficult to figure out how many of these tweets are retweets, and which users who tweet about us get the most retweets. This information might help us identify key people talking about Udemy. Using regular expressions allows us to do that.

Utilizing the programming language R and the twitter API, we collected 3,200 tweets mentioning Udemy on September 18th, 2015 (3,200 is the limit for any given search from the Twitter API). We then used the following regular expression to identify which of these tweets are retweets:

Essentially, this regular expression looks for all tweets that contain the terms "RT" or "via" and then some text with an @ sign. These are the most common patterns for a retweet. Using this expression, we discovered, for example, that the user @bobijanson retweeted a tweet by @AngularJSFan about a Udemy course on, not surprisingly, AngularJS.

The follow table displays the top 10 users in terms of whose Udemy related tweets were retweeted on that day.

The most retweeted user that day was @codek_tv, which is the twitter handle for Code Geek, a group that teaches an online class on Python. The third most retweeted user, @realKarenPrince, is a young adult fantasy writer and teacher of a Udemy class on the writing software Scrivener.

We can also look at the users who retweeted the most posts about Udemy.

The user @javascriptd retweeted tweets about Udemy 24 times in less than 24 hours! @javascriptd is a twitter handle created by Simba Systems to deliver news about Javascript, and it has nearly 8,000 followers. This is a great user to be getting so many retweets from! Mostly, they are promoting one of our offers for a course to learn "Javascript from Scratch."

We can also take retweets about us and look at them on a social graph. The following visualization displays the people who retweeted the 5 twitter users whose mentions of Udemy were most retweeted. For example, in the top right, we can see the names of the 9 different users who retweeted @UpStartup.

All of this business intelligence is only easily available because of regular expressions. Without regular expressions, we'd spend all day counting tweets by hand.

Whether it be for business, academics, and sometimes just for fun, the pattern matching and analysis made possible by regular expressions has expanded the world for everyone who works with text. Many data analysts are joyous about the possibilities.

Analysts are no longer stuck working with boring old numbers. Thanks to regular expressions, the rich information that is only available in text, is ours to explore.