Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page



 

Regex

Short for regular expression, a regex is a string of text that enables a user to quickly create pattern matching and quickly and easily locate and manage text. Perl is a great example of a programming language that utilizes regular expressions. Below are a few examples of regular expressions and pattern matching in Perl.

$data =~ s/bad data/good data/i;

The above example replaces any "bad data" with "good data" using an insensitive case match.

$data =~ s/a/A/i;

The above example replaces any lowercase "a" with an uppercase "A".

$data =~ s/[a-z]/*/;

The above replaces any lowercase letter, a through z, with an asterisk.

Users who are interested in regular expressions in software programs, such as grep, or in their programming language of choice, should definitely check out the O'Reilly book "Mastering Regular Expressions".

Also see: Escape sequence, Expression, Meta-character, Programming definitions

 

Index

Category:
Dictionary

Related Pages:
R - Definitions

 

Resolved

Were you able to locate the answer to your questions?

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope