regular expression for perl, tcl, sed, grep, awk

J

Jay eL

Hi all,

I wonder is the regular expression the same for perl, tcl, sed, grep
and awk except for the syntax? all the usage for . * ? + / () [] are
the same?

Thanks in advance
 
M

Martien Verbruggen

Hi all,

I wonder is the regular expression the same for perl, tcl, sed, grep
and awk except for the syntax?

It's a bit of an odd question. What do you mean "the same" "except for
the syntax"? The syntax is different in many cases, and the features
are also different for many of them. It also depends on your platform
which sorts of RE are supported by your sed, grep and awk. There are
minimal sets defined by standards, but that doesn't mean that your
local ones don't support more.

Generally: unless the software specifically mentions that it supports
Perl's RE, it won't. Perl's RE engine is pretty much the most powerful
out there (pcre is a library making Perl RE available to other
programs).

Some tools support more than one RE syntax, depending on invocation
and arguments.

I don't know which RE tcl supports nowadays. I haven't touched it in
about 8 years.
all the usage for . * ? + / () [] are
the same?

The slash is not a special character in regular expressions, but it's
most often used as the delimiter for the operators that take regular
expressions in tools that do.

The others should all pretty much act the same, although in some RE
engines you actually need to escape some of them to make them special.

You'll have to read the documentation of the tool or language you're
interested in to find out more.


Why did you ask this question in a Perl group? Or did you post it
independently to a bunch of other groups as well?

Martien
 
J

James Willmore

On 8 Dec 2003 17:59:53 -0800
Hi all,

I wonder is the regular expression the same for perl, tcl, sed, grep
and awk except for the syntax? all the usage for . * ? + / () []
are the same?

perldoc perlre

This will give information on regular expressions usage in Perl. I'm
thinking other languages have documentation as well.

O'Reilly has a book .... "Mastering Regular Expressions". Maybe this
would aid in whatever comparison you're making. I don't know off hand
if there are any resources on the 'Net for this - but if you use
Google, you might get some hits.

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Hark, Hark, the dogs do bark The Duke is fond of kittens He likes
to take their insides out And use them for his mittens From "The
Thirteen Clocks"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top