From the course: PHP: Clean URLs on Apache Server
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Creating simple regular expressions - PHP Tutorial
From the course: PHP: Clean URLs on Apache Server
Creating simple regular expressions
- [Voiceover] Some knowledge of regular expressions is essential for using mod_rewrite. If you're comfortable with regular expressions, you can skip this video. Otherwise, keep watching. Let's start with a brief explanation of what regular expressions are. They're used to match text patterns. In some respects, they're similar to wildcard characters, but they're much more powerful. One of the most powerful features is the ability to use capturing groups to store matched text for reuse. This allows you to create highly adaptable rewrite rules. Let's take a look at the basic rules of creating a regular expression, or regex, for short. Literal text matches itself, but you can separate alternatives with a vertical pipe. For example, this matches either arrangements or flowers. The caret and dollar sign are anchors for the beginning and end of the pattern. A caret at the beginning means the matching text must begin with the same pattern. While a dollar sign at the end means the matching…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.