submit urlsubmit rss feedadd directory

article

A regular expression (abbreviated as regexp or regex, with plural forms regexps, regexes, or regexen) is a string that describes or matches a set of strings, according to certain syntax rules. Regular expressions are used by many text editors and utilities to search and manipulate bodies of text based on certain patterns. Many programming languages support regular expressions for string manipulation. For example, Perl and Tcl have a powerful regular expression engine built directly into their syntax. The set of utilities (including the editor sed and the filter grep) provided by Unix distributions were the first to popularize the concept of regular expressions.

Basic concepts


A regular expression, often called a pattern, is an expression that describes a set of strings. They are usually used to give a concise description of a set, without having to list all elements. For example, the set containing the three strings Handel, Händel, and Haendel can be described by the pattern "H(ä|ae?)ndel" (or alternatively, it is said that the pattern matches each of the three strings). In most formalisms, if there is any regex that matches a particular set then there is an infinite number of such expressions. Most formalisms provide the following operations to construct regular expressions.

alternation
A vertical bar separates alternatives. For example, "gray|grey" matches gray or grey, which can commonly be shortened to "gr(a|e)y".
grouping
Parentheses are used to define the scope and precedence of the operators. For example, "gray|grey" and "gr(a|e)y" are different patterns, but they both describe the set containing gray and grey.
quantification
A quantifier after a character or group specifies how often that preceding expression is allowed to occur. The most common quantifiers are ?, *, and +:
?
The question mark indicates there is 0 or 1 of the previous expression. For example, "colou?r" matches both color and colour.
*
The asterisk indicates there are 0, 1 or any number of the previous expression. For example, "go*gle" matches ggle, gogle, google, etc.
+
The plus sign indicates that there is at least 1 of the previous expression. For example, "go+gle" matches gogle, google, etc. (but not ggle).

More on [ Regular expression ]


directory of related categories

 

 

 
Regular_Expressions RSS feed
eWeek - RSS Feeds

The Risks In Wildcard Certificates
Sat, 11 Oct 2008 09:43:20 -0400
They may not be real-world problems, but wildcard certificates have some definite theoretical problems. But they can be so much cheaper that users will buy them anyway. - The imperative to use SSL, for web authentication and encryption or VPNs, is reasonably universal. Competition has driven prices of certificates down over the years to the point where you can get conventional SSL certificates from reputable vendors for well under $100 per year. Another product gain...
FCC Likely to Recommend Unlicensed Spectrum Use
Fri, 10 Oct 2008 17:09:07 -0400
The Federal Communications Commission will soon release a report on the feasibility of opening up unused spectrum, or white spaces, for use with wireless broadband. The FCC engineering report will share results of several years of data collection, including field tests on Broadway in New York City and at FedEx Field in Maryland. - WASHINGTON (Reuters) A battle between tech companies like Google Inc and broadcasters over use of soon-to-be vacant airwaves will heat up soon as U.S. regulators release an anticipated report on the issue. The Federal Communications Commission's report will weigh in as early as Friday on the fea...
Enterprise 2.0 Software to Take Hard Hits Amid Competition, Weak Economy
Fri, 10 Oct 2008 14:26:55 -0400
Spending on Enterprise 2.0 messaging and collaboration technologies will take a hit, according to Forrester Research. The research company says cutthroat competition and oversaturation of blogs, wikis, mashups and RSS feeds will curb spending, but predicts growth for mashups. At what point will Forrester have to factor the dragging economy into the slowdown in spending on anything from Enterprise 2.0 to enterprise applications? - Just a few weeks ago, the Enterprise 2.0 world was humming along smoothly, to all outward appearances. Vendors and analysts alike were bullish on growth prospects for modern collaboration and productivity platforms. The tide is turning, according to an analysis from Forrester Research analyst...
Intel, AMD Earnings to Offer Guidance on PC, IT Spending
Fri, 10 Oct 2008 13:24:03 -0400
When Intel and AMD report their third-quarter earnings in a few day, the two companies, which are the leading suppliers of x86 processors for desktops, notebooks and servers, are expected to offer a glimpse of how the financial crisis and the U.S. credit crunch is likely to impact the entire IT industry. In addition, Intel and AMD are likely to discuss the impact of the new chip manufacturing that formed when AMD sold off its fabs earlier this month. - When Intel and Advanced Micro Devices, the two largest suppliers of x86 processors for PCs and servers, report their 2008 third-quarter financial results in a few days, industry watchers will be looking for signs of how those numbers will reflect the ongoing financial crisis and its impact on the IT...
Apple Releases Mega Patch Security Update
Fri, 10 Oct 2008 11:08:25 -0400
Apple released a large security update that touches on nearly two dozen Mac applications and features. The release includes updates for Apache, PHP, ClamAV and MySQL. - Apple has released a massive update for Mac OS X 10.5 and Mac OS X 10.4.11 that plugs security gaps in 20 Mac applications and features. The update, released Sept. 9, is available on Apples Web site. Several of the patches deal with Mac OS X technologies, such as a fix for an issue in Script Edi...
10 Steps Techies Should Take to Keep Their Jobs in a Financial Meltdown
Fri, 10 Oct 2008 10:44:41 -0400
As the economy gets shakier each day, workers everywhere are concerned about losing their jobs. Here are 10 steps the corporate techie toiling away in the server room or the help desk can take to help keep his or her job. - OK, the stock market is falling like a rock. Big banks are being bought and sold like overripe bananas. The masters of the financial universe are looking like suckers at the horse race track buying tip sheets printed after each race. And now, even the venture capitalists of Silicon Valley are te...

The Seattle Times: Business & Technology

The Great Disruption hits Puget Sound hard
Sat, 11 Oct 2008 17:39:00 -0700
An entire business model that increasingly powered the American economy has collapsed. It was dependent not only on little understood financial schemes but also on mergers — instead of capitalizing companies that actually made things, especially advanced technological breakthroughs — and unsustainable earnings growth. It was based on debt and consumption.
History shows investors in stocks can bounce back in worst of times
Sat, 11 Oct 2008 18:22:23 -0700
Let's deal with your worst fantasies: the "D" word. Some people have bandied it about — the prospect that perhaps this is the big...
Sunday Buzz: Real estate in play as WaMu and others shrink
Sat, 11 Oct 2008 18:10:16 -0700
In the Seattle area and elsewhere, the tumult of merging and downsizing companies — WaMu, Wachovia, Merrill Lynch, AIG, etc. — will likely redraw real-estate vacancy maps, so brokers are preparing.

NYT > Technology

Amid the Gloom, an E-Commerce War
Sat, 11 Oct 2008 23:43:02 -0000
EBay was once an online juggernaut and Amazon.com its weaker rival. Things have changed.
Novelties: Keeping Your Own Health Chart, Online
Sat, 11 Oct 2008 18:40:23 -0000
New tools are being developed that may help harried patients monitor their medications, home tests and other details.
Verizon Wireless Plans to Charge Companies Sending Text Messages
Sat, 11 Oct 2008 04:53:14 -0000
Verizon told companies that send out text messages that starting Nov. 1 it will impose a fee of 3 cents for each message it delivers to the phones of its subscribers.

CNN.com - Technology

New machine prints sheets of light
Fri, 10 Oct 2008 11:29:17 -0400
Read full story for latest details.
Shark mom has 'virgin birth'
Fri, 10 Oct 2008 02:52:51 -0400
Read full story for latest details.
Keeping track of climate change
Fri, 10 Oct 2008 11:35:12 -0400
It can often seem like hard work keeping track of the changes happening to our planet. Another day, another new prediction. Another week, another warning. It's enough to make even the most conscientious climate change student issue a weary discombobulated sigh.

NPR Topics: Technology

Fast, Citywide WiFi Launches In Baltimore
Thu, 09 Oct 2008 08:19:00 -0400
The nation's first rollout of WiMax has launched in Baltimore. Host Steve Inskeep talks to tech commentator Mario Armstrong about the fourth generation Internet service. It's a wireless connection that is fast and allows a subscriber to roam across the city.
New Solar Cell Easy As Pizza To Make
Sat, 04 Oct 2008 12:16:00 -0400
The iJET is a new type of solar cell that's cheap and easy to make, requiring not much more than a pizza oven, some nail polish remover, and a common inkjet printer. Australian scientist Nicole Kuepper describes her invention.
SpaceX Celebrates First Successful Rocket Launch
Fri, 03 Oct 2008 13:53:00 -0400
SpaceX's flagship Falcon1 rocket has successfully launched from an island in the central Pacific, becoming the first privately-developed rocket to orbit the planet. NASA has already contracted SpaceX to begin private space flight missions to the International Space Station beginning in 2010.

BBC News | Technology | UK Edition

Bank turmoil fuels phishing boom
Fri, 10 Oct 2008 11:38:19 -0000
Scammers and fraudsters are capitalising on the changes sweeping through global financial markets and sectors.
'Spam attack' halts Virgin e-mail
Fri, 10 Oct 2008 16:32:02 -0000
Tens of thousands of Virgin.net customers lose e-mail access for up to four days after a suspected spam attack.
Channel 4 abandons digital radio
Fri, 10 Oct 2008 11:15:31 -0000
Channel 4 pulls the plug on three proposed digital radio stations owing to a slump in advertising revenues.

Reuters Video: Technology

Facebook eyes growth over profits
Sun, 12 Oct 2008 04:39:44 -0400
Oct. 12 - On a visit to London as part of a multi-city European trip, Facebook founder Mark Zuckeberg explains his strategy for navigating a tough economic climate.
Reuters Technology Week
Fri, 10 Oct 2008 14:38:38 -0400
Oct. 10 - Palin dukes it out digitally, super strong scents, and prize-winning protein.
Shazam enters new era
Sun, 05 Oct 2008 20:22:20 -0400
Oct 6 - The mobile music discovery service has seen a surge of new users after broadening its offering to work seamlessly with social networks.

AP Top Technology News At 7:11 p.m. EDT

Kenya's elephants send text messages to rangers
By KATHARINE HOURELD Sat, 11 Oct 2008 23:10:50 -0000
OL PEJETA, Kenya (AP) -- The text message from the elephant flashed across Richard Lesowapir's screen: Kimani was heading for neighboring farms....
Flexible OLEDs could be part of lighting's future
By PETER SVENSSON Sat, 11 Oct 2008 04:39:15 -0000
NISKAYUNA, N.Y. (AP) -- On a bank of the Mohawk River, a windowless industrial building of corrugated steel hides something that could make floor lamps, bedside lamps, wall sconces and nearly every other household lamp obsolete....
Sony seeks to harmonize music, electronics
By RYAN NAKASHIMA Fri, 10 Oct 2008 21:38:01 -0000
LOS ANGELES (AP) -- Now that Sony Corp. and Bertelsmann AG have broken off their troubled relationship, known as Sony BMG, the Japanese company hopes to harmonize its consumer electronics and its music, a duo that was badly out of sync....

CNET News.com

IBM invests in business partners' training
Sat, 11 Oct 2008 17:01:00 -0700
A business development fund aims to encourage its largest partners to take up more skills training around data centers.
Navy charters kite-powered cargo ship to deliver equipment
Sat, 11 Oct 2008 11:03:00 -0700
The use of this new breed of sailing ship could reduce fuel costs by 20 to 30 percent, according to the ship's owners.
FCC report negates free Internet interference claims
Sat, 11 Oct 2008 10:41:00 -0700
Report from commission engineers boosts plan to auction spectrum for free wireless Internet by dismissing concerns it would interfere with existing providers' signals.

 
Subscribe to Computers RSS feed

directory of related sites

VBA - Regular expression library for Visual Basic and Visual Basic for Applications.
Meta Description: [ Regular expressions for Visual Basic and VBA. Add string search capabilities to your VB adds without run-time files. VB grep. ]

12 Reasons to Use Regular Expressions - An article that gives 12 reasons for learning and using Regular Expressions.

A 'Print This Page' Script Using the MS-XMLHTTP object and Regular Expressions - This article, by Troy Eberhard, examines how to create a Printer Friendly Page using Microsoft's XMLHTTP component along with regular expressions.
Meta Description: [ This article, by Troy Eberhard, examines how to create a Printer Friendly Page using Microsoft's XMLHTTP component along with regular expressions. Troy shows how to use XMLHTTP to perform an actual HTTP GET request for the page that you wish to displ... ]

An Introduction to Regular Expression with VBScript - Articles in two parts about using Regular Expressions with VCScript.
Meta Description: [ Do you know what regular expression is? Have you ever used regular expression in your programming before? Well, if the answer is no, or if you're not too familiar with Regular Expression, then this article is for you! I (Scott Mitchell) am fairly new to regular expression; I've written small P... ]

Common Applications of Regular Expressions - This article by Richard Lowe demonstrates four powerful and practical applications of regular expressions.
Meta Description: [ This great article, by Richard Lowe, demonstrates four powerful and practical applications of regular expressions. Richard provides excellent examples and explanations for using regular expressions to perform string validation, HTML screen-scrapes, data-fil... ]

500 DevShed - So What's A $#!%% Regular Expression, Anyway?! - Regular expressions are one of the most powerful tools in the arsenal of any *NIX programmer. This article offers insights into what they are, how to go about constructing them, and how to add them to your Perl, PHP and JavaScript programs.

Extreg - A script that allows to perform search-and-replace operations with extended regular expressions from unix shells.
Meta Description: [ How to perform search-and-replace operations with extended regular expressions. ]

404 Geek Talk: The Regular Expression Rundown - What is a regular expression? Crispin Roven has the answer. Newbie-oriented. [Wired News]

JRX - A simple JavaScript real-time regular expression evaluator, similar to RX tool of Activestate's Komodo IDE.
Meta Description: [ This is a simple JavaScript real-time regular expression evaluator, similar to RX tool of Activestate's Komodo IDE ]

KRegExpEditor - Manual - A Manual describing the KDE Application for editing regular expressions.
Meta Description: [ This Handbook describes the Regular Expression Editor widget ]

Larger Regular Expressions - The purpose of this article is to show a few real-life examples of regular expressions at work.
Meta Description: [ zez.org: about code ]

Matchmaking with regular expressions - Shows how to use the power of regular expressions to ease text parsing and processing.
Meta Description: [ Many applications process configuration or log files, retrieving configuration info and extracting meaningful information from a sea of text. They also require a parser for simple expressions. There are better tools for these tasks than the standard String or StringTokenizer classes with their ru... ]

PCRE Workbench - Graphical application for Windows which can be used to experiment with Perl-compatible regular expressions interactively.
Meta Description: [ PCRE Workbench is a small application that I wrote to ease the process of designing regular expressions for use with Philip Hazel's PCRElibrary. ]

PCRE Wrapper for Delphi 7 - Provides Wrapper classes that provide PCRE for Delphi.
Meta Description: [ PCRE Wrapper for Delphi 7. ]

Power REGex TESTER - An online tool for creating and testing regular expressions.
Meta Description: [ Regex validation. Test PHP, Perl or Javascript regular expression - instant live AJAX online testing tool (regex validator). Search and replace with RegExp. ]

Regex Suite - Brings the power of regular expression searching and replacing to Frontier 5. [GPL]
Meta Description: [ Regex Project. Title of this page : REGEX EXTENSION HOME PAGE ]

RegEx Tester - Online regular expression tester for preg (Perl) and ereg (POSIX) formats.
Meta Description: [ Welcome to Quanetic.com, Kurt Milligan 's virtual sandbox for PHP and PostgreSQL, and place to spout off about things like chess, acoustics, and computers. ]

RegexBuddy - Tool for creating, debug, implement and save regular expressions for Windows and Linux. [Commercial]
Meta Description: [ RegexBuddy is your perfect companion for working with regular expressions. Learning, creating, understanding, testing, using and saving regular expressions has never been easier. ]

RegExplorer - A visual regular expression explorer, it allows for writing regular expressions and visually see the matches. Uses the KDE/Qt Libraries for the user interface. [QPL]

Regular Expression Builder - An open source tool written in C# to build and test regular expressions.

500 Regular Expression Tester - Online script to test regular expressions. Shows matching patterns in red. PHP source code available for download, includes regular expression cheat sheet.

Regular Expression Tester - Uses browser's JavaScript to show matches and subgroups, and highlights match in the input string.

Regular Expression Usage in C# - The source code shows how to use Regular Expressions in C#.
Meta Description: [ The source code shows how to use Regular Expressions in C#. ]

404 Regular Expressions - Describes Regular Expressions and compares them to Finite Automatas.
Meta Description: [ The error page for the website of Rochester Computer Science Department (URCS). ]

Regular Expressions explained - An article by Jan Borsodi that gives an introduction to the world of regular expressions. It explains what regular expressions are and introduces the syntax. Also provides examples with varying complexity and a list of tools which use regular expressions.
Meta Description: [ zez.org: about code ]

Regular expressions in Haskell - Native Haskell implementation of polymorphic regular expressions. The regexps contains most of the features found in Perl.

Regular Expressions Library - A collection of regular expressions submitted by viewers.
Meta Description: [ Regular Expression Library provides a searchable database of regular expressions. Users can add, edit, rate, and test regular expressions. ]

Regular Expressions Quickstart - An article about regular expressions in ASP pages.
Meta Description: [ .NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance. ]

Simplifed use of Regular Expressions from within your Scripts - A small library to make working with Regular Expressions a little bit easier. Free source code and tutorials for Windows developers.
Meta Description: [ Small library to make working with Regular Expressions a little bit easier ]

So What's A $#!%% Regular Expression, Anyway?! - Learn how to use regular expressions and perform search and replace operations.

Stripping HTML Tags using Regular Expressions - This article, by Scott Mitchell examines how to strip HTML tags from a string using regular expressions.
Meta Description: [ This article, by Scott Mitchell, examines how to strip HTML tags from a string using regular expressions. The article presents a cleanly written, easy-to-read function that accepts a single string input and returns a copy of the input that's had all of its HTML tags... ]

TCL Regular Expressions - An Introduction to Regular Expressions in the scripting language TCL.

500 The not-so-Regular of Regular Expressions - Weblog about regular expressions: tricks and hacks, recipes, tutorials.

The Regex Coach - Graphical application for Linux and Windows which can be used to experiment with (Perl-compatible) regular expressions interactively.

500 TRegExpr - A Delphi port of Henry Spencer V8-routins for working with a subset of Perl Regular Expressions. Full source code in object pascal included. No DLL needed. [Freeware]
Meta Description: [ delphi pascal FreePascal Kylix freeware components: regular expressions (r.e. RegExpr regexp tregexpr), egrep perl unix; Andrey Sorokin ]

Utilizing Regular Expression SubMatches - This article by Scott Mitchell examines some advanced features with regular expressions.
Meta Description: [ This article, by Scott Mitchell, examines some advanced features with regular expressions. Specifically, the article looks at using the dollar-sign notation to refer back to string matches when using the regular expression object's Replace function. Also, the SubMa... ]

Utilizing Regular Expressions - This article is a follow-up to an earlier 4Guys article An Introduction to Regular Expression with VBScript. Regular Expression allows for complex pattern matching and replacing.
Meta Description: [ This article is a follow-up to an earlier 4Guys article, An Introduction to Regular Expression with VBScript. Regular Expression allows for complex pattern matching and replacing. Regular Expression has a vast multitude of uses, in my opinion, and is one of ... ]

Validating Form Input using Regular Expressions - Writing form validation code is often the most thankless part of your job. The logic can get quite complex, and often quite messy. This article will show how to use Regular Expressions to simplify your code.
Meta Description: [ This is an article from the old aspZone.com Writing form validation code is often the most thankless part of your job. The logic can get quite complex, and often quite messy. This article will show you how to use Regular Expressions to simplify your ]

VBScript Regular Expressions - Describes the improved text handling functions of version 5 of VBScript through its support for Regular Expressions.
Meta Description: [ An introductory guide to using regular expressions for string pattern matching in VBScript ]

Visual RegExp - A graphical explorer for your regular expressions. Requires Tcl/Tk 8.x.

windows.oreilly.com -- C# Regular Expressions - Brad Merrill, coauthor of O'Reilly's C# Essentials, provides an overview of how regular expressions are used in the C# environment.
Meta Description: [ O'Reilly coauthor provides overview of how regular expressions are used in the C# environment. By Brad Merrill, coauthor of O'Reilly's C# Essentials (February 2001). ]

Regular_Expressions related videos
Introducing regular expressions ...
Next Video

 

HOMEADVERTISINGABOUT US

articlesartsbusinesscomputersgameshealthhospitalshomekids & teensnewsmobilephysiciansrecreationreferenceregionalscienceshoppingsocietysportsworld


Submit a Site About Become an Editor