Just Great Software

RegexBuddy - Learn, create, understand, test, use and store regular expressions

 Introduction 

 

 Buy Now 

 Our Guarantee 

 Download 

 Testimonials 

 Contact Us 

 User Forum 

 

 Screen Shots 

 Live Demos 

 Regular Expressions 

 Features & Benefits 

 Programming 

 C# 

 Delphi 

 GNU BRE & ERE 

 Groovy 

 Java 

 JavaScript 

 MySQL 

 Oracle Database 

 PCRE 

 Perl 

 PHP 

 POSIX BRE & ERE 

 PostgreSQL 

 PowerShell 

 Python 

 R Language 

 REALbasic 

 Ruby 

 Tcl ARE 

 VB6 & VB.NET 

 VBScript 

 wxWidgets 

 XML Schema 

 Linux 

 

 Press Resources 

 Version History 

 Newsletter 

 Blog 

 Affiliates 

 

 

PowerGREP - Find files and information or search and replace through files and folders
RegexMagic - Generate regular expressions
EditPad - Convenient, powerful and versatile text editor to edit all kinds of text files
AceText - Store, manage, edit and reuse text from a central location
DeployMaster - Installation builder delivering your software with a good first impression
HelpScribble - Full-featured help authoring tool for creating help files from start to finish
      

Introduction to Regular Expressions and Regexp Syntax

What Is a Regular Expression or Regex?

A regular expression is a special text string for describing a search pattern. You can think of regular expressions as wildcards on steroids. You are probably familiar with wildcard notations such as *.txt to find all text files in a file manager. The regex equivalent is .*\.txt.

But you can do much more with regular expressions. In a text editor like EditPad Pro or a specialized text processing tool like PowerGREP, you could use the regular expression \b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b to search for an email address. Any email address, to be exact. A very similar regular expression can be used by a programmer to check if the user entered a properly formatted email address. In just one line of code, whether that code is written in Perl, PHP, Java, a .NET language or a multitude of other languages.

Since "regular expressions" is a mouthful, you will usually find the term abbreviated as "regex" or "regexp". I prefer "regex", since it can be easily pluralized as "regexes".

      
Only US$ 39.95
Windows 98, ME, NT4, 2000, XP, Vista, and 7
100% satisfied or money back

RegexBuddy Makes Regular Expressions Easy

I know. The regex to match any email address looks quite intimidating. But RegexBuddy makes the regex syntax crystal clear. If JavaScript is enabled in your browser, moving the mouse over the regex below or the descriptions will highlight corresponding parts. RegexBuddy does the same while you create a regular expression or analyze a regex written by somebody else.

With a bit of practice and assistance from RegexBuddy, you will soon become proficient at crafting regular expressions. Oh, and you definitely do not need to be a programmer to take advantage of regular expressions! (Read on below.)

\b[A-Z0-9._%-]++@[A-Z0-9._%-]+\.[A-Z]{2,4}\b

  • Assert position at a word boundary
  • Match a single character out of the list: one of the characters "._%-", or in the range between A and Z, or in the range between 0 and 9
    • Between one and unlimited times, as many times as possible, without giving back (possessive)
  • Match the character "@" literally
  • Match a single character out of the list: one of the characters "._%-", or in the range between A and Z, or in the range between 0 and 9
    • Between one and unlimited times, as many times as possible, giving back as needed (greedy)
  • Match the character "." literally
  • Match a single character in the range between A and Z
    • Between 2 and 4 times, as many times as possible, giving back as needed (greedy)
  • Assert position at a word boundary

Save Time and Effort with Regexes

Basically, a regular expression is a pattern describing a certain amount of text. That makes them ideally suited for searching, text processing and data validation.

Searching with regular expressions enables you to get results with just one search instead of many searches. Searching for the word "separate" and all of its common misspellings is easy with the regex s[ae]p[ae]r[ae]te. If you forgot the phone number of your friend who moved to Anguilla, search your past correspondence for \b1?264[)- ]*\d{3}[- ]*\d{4}\b and get a handy list of all phone numbers in area code 264, regardless of the notation style used.

Update large amounts of data by searching and replacing with regular expressions. The benefit of using regular expressions to update data is that with a single regex pattern, you can dynamically update a variety of data. E.g. search for (copyright +(©|\(c\)|©) +\d{4})( *[-,] *\d{4})* and replace with \1-2007 to update all copyright statements to 2007, regardless of the style of copyright symbol and the current copyright year. "copyright (c) 1996-2002" is replaced with "copyright (c) 1996-2007", while "Copyright © 2003" is replaced with "Copyright © 2003-2007", etc. This takes only a few minutes to set up and a dozen seconds to run with RegexBuddy's built-in GREP tool. Imagine making those changes by hand.

Let RegexBuddy Make Regex Easy for You

"I am really enjoying using your program, and before this, I hated regular expressions. Now, I've gone over to the dark side, and I love them."

-- Tim Gallagher
   2 March 2006, Kansas, USA

RegexBuddy’s plain English regex tree makes it easy to understand exactly what a regular expression does

RegexBuddy’s plain English regex tree makes it easy to understand exactly what a regular expression does

 

 

Page URL: http://www.regexbuddy.com/regex.html
Page last updated: 05 June 2007
Site last updated: 03 March 2010

Published by Just Great Software Co. Ltd.
Copyright © 2004-2010 Jan Goyvaerts.
All rights reserved.