1. Home
  2. Computing & Technology
  3. Python

Python Regular Expressions (regex): Forming a Regular Expression in Python

From , former About.com Guide

4 of 10

Python Strings Along Dogs and Cats

A single Python string containing the words 'dog' and 'cat'

A single Python string containing the words 'dog' and 'cat'

A Lukaszewski

This distinction also applies to word boundaries within a character string. This image shows how the a character string "dog cat" would appear in memory. The word boundaries are highlighted in red and the string boundaries are highlighted in green. You will note that the medial blank space is open -- it is not null. The leftmost green boundary is the beginning of the character string. The red boundary that follows it is the beginning of the first word.

Understanding the parameters of string boundaries and the boundaries of a string's contents, we can look at the metacharacters of regex formulation.

Explore Python
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Python
  4. Regular Expressions
  5. Python Regular Expressions - Python Regex - Python Strings Along Dogs and Cats

©2009 About.com, a part of The New York Times Company.

All rights reserved.