文档介绍:Tutorial: Using regular expressions
Section 1. Introduction to the tutorial
Who is this tutorial for?
This tutorial is aimed at programmers who work
with tools that use regular expressions, and who
would like to e fortable with the
intricacies of regular expressions. Even
programmers who have used regular expressions
in the past, but have forgotten some of the details,
can benefit from this tutorial as a refresher.
pleting this tutorial, you will not yet be an
expert in using regular expressions to best
advantage. But this bined with lots of
practice with varying cases is about all you need to
be an expert. The concepts of regular expressions
are extremely simple and powerful -- it is their
application that takes some work.
Just what is a regular expression, anyway?
Take the tutorial to get the long answer. The short answer is that a regular expression
is pact way of plex patterns in texts. You can use them to search
for patterns and, once found, to modify the patterns plex ways. You can also use
them to launch programmatic actions that depend on patterns.
A tongue-in-ment by programmers is worth thinking about: "Sometimes you
have a programming problem and it seems like the best solution is to use regular
expressions; now you have two problems." Regular expressions are amazingly
powerful and deeply expressive. That is the very reason writing them is just as
error-prone as writing any plex programming code. It is always better to
solve a genuinely simple problem in a simple way; when you go beyond simple, think
about regular expressions.
Tutorial: Using regular expressions Page 1
Presented by developerWorks, your source for great tutorials /developer
What tools use regular expressions?
Many tools incorporate regular expressions as part of their functionality. UNIX-oriented
command line tools like grep, sed, and awk are mostly wrapper for regular-expression
processing. Many text editors allow search and/or replacement