The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
regexp help TinCanFury Shell Programming and Scripting 0 04-06-2008 03:21 PM
First US GPL lawsuit to settle out of court - LinuxDevices.com iBot UNIX and Linux RSS News 0 09-24-2007 10:40 AM
regexp with sed again!!! andy2000 Shell Programming and Scripting 2 05-03-2007 07:15 AM
Microsoft and Sun Settle Litigation pressy News, Links, Events and Announcements 1 04-02-2004 05:55 PM
No 5 fail. When install Patches. How to settle? cloudsmell UNIX for Dummies Questions & Answers 1 11-06-2002 07:55 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-17-2008
Registered User
 

Join Date: May 2007
Posts: 104
Stumble this Post!
RegExp - settle a bet

A couple co-workers have a disagreement. Can you guys please settle this?

One co-worker says regular expressions can inherently search and replace. His argument is that he can do a s/ regexp / replace in perl (and many other languages).

The other says that by definition regular expressions is just pattern matching and that is an outside function doing the replacing.

Thoughts?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-17-2008
Registered User
 

Join Date: Apr 2008
Posts: 6
Stumble this Post!
Quote:
Originally Posted by earnstaf View Post
A couple co-workers have a disagreement. Can you guys please settle this?

One co-worker says regular expressions can inherently search and replace. His argument is that he can do a s/ regexp / replace in perl (and many other languages).

The other says that by definition regular expressions is just pattern matching and that is an outside function doing the replacing.

Thoughts?
Regular Expressions are just patterns...They do not perform any functions...It is the commands like sed or tr that we use along with the regular expression performs the functions like substitute/translate the pattern matched.

Its just my thought!
Reply With Quote
  #3 (permalink)  
Old 04-17-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Stumble this Post!
Concur, the substitution facility is not part of the regular expression formalism proper.

The original implementation of regular expressions was by Ken Thompson in the QED (and later ed) editor. Certainly, there was the s/re/p command in that already then, but his paper on regular expressions describes the "search" part and the underlying mathematical formalism, a concept called "regular sets" which is where the "regular" part in the name comes from.

Ken Thompson - Wikipedia, the free encyclopedia
Regular expression - Wikipedia, the free encyclopedia

K. Thompson, Regular Expression Search Algorithm, Comm. Assoc. Comp. Mach., Vol. 11, 6, pp. 419--422, 1968.

(It's the very first article in his publications list at http://www.cs.bell-labs.com/cm/cs/bib2html/ken.htm)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
regex, regular expressions

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0