Sponsored Content
Full Discussion: RegExp - settle a bet
Top Forums UNIX for Dummies Questions & Answers RegExp - settle a bet Post 302186490 by gkalangi on Thursday 17th of April 2008 10:53:29 AM
Old 04-17-2008
Quote:
Originally Posted by earnstaf
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!
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

No 5 fail. When install Patches. How to settle?

Install 2.6Recommanded on 2 workstations, one works, but the other one has many No 5 fail. the log says: Installing 106361-14... WARNING: /usr/sbin/patchadd is being used to install this patch. Checking installed packages and patches... Executing prepatch script... Verifying... (1 Reply)
Discussion started by: cloudsmell
1 Replies

2. News, Links, Events and Announcements

Microsoft and Sun Settle Litigation

http://www.microsoft.com/presspass/press/2004/apr04/04-02SunAgreementPR.asp no comments sad pressy (1 Reply)
Discussion started by: pressy
1 Replies

3. Programming

how to run prog bet to break points

Hi, I have set two break points at 500 and 572 lines respectively. after running prog using (gdb) run i m on the line 500 but how two go to second breakpoints ie line 572 . when i m giving (gdb) run it is asking again to run from starting lines . (1 Reply)
Discussion started by: useless79
1 Replies

4. Shell Programming and Scripting

script to read a line with spaces bet " " and write to a file

Hi, I need a command in UNIX KSH below is the description... MAPPING DESCRIPTION ="Test Mapping for the calid inputs" ISVALID ="YES" NAME ="m_test_xml" OBJECTVERSION ="1" VERSIONNUMBER ="1" unix ksh command to read the DESCRIPTION and write to a file Test Mapping for the calid inputs... (3 Replies)
Discussion started by: perlamohan
3 Replies

5. UNIX for Dummies Questions & Answers

print the line immediately after a regexp; but regexp is a sentence

Good Day, Im new to scripting especially awk and sed. I just would like to ask help from you guys about a sed command that prints the line immediately after a regexp, but not the line containing the regexp. sed -n '/regexp/{n;p;}' filename What if my regexp is 3 word or a sentence. Im... (3 Replies)
Discussion started by: ownins
3 Replies

6. Shell Programming and Scripting

Find diff bet 2 files and store result in another file

Hi I want to compare 2 files. The files have the same amount of rows and columns. So each line must be compare against the other and if one differs from the other, the result of both must be stored in a seperate file. I am doing this in awk. Here is my file1: Blocks... (2 Replies)
Discussion started by: ladyAnne
2 Replies
textutil::trim(3tcl)				    Text and string utilities, macro processing 			      textutil::trim(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
textutil::trim - Procedures to trim strings SYNOPSIS
package require Tcl 8.2 package require textutil::trim ?0.7? ::textutil::trim::trim string ?regexp? ::textutil::trim::trimleft string ?regexp? ::textutil::trim::trimright string ?regexp? ::textutil::trim::trimPrefix string prefix ::textutil::trim::trimEmptyHeading string _________________________________________________________________ DESCRIPTION
The package textutil::trim provides commands that trim strings using arbitrary regular expressions. The complete set of procedures is described below. ::textutil::trim::trim string ?regexp? Remove in string any leading and trailing substring according to the regular expression regexp and return the result as a new string. This is done for all lines in the string, that is any substring between 2 newline chars, or between the beginning of the string and a newline, or between a newline and the end of the string, or, if the string contain no newline, between the beginning and the end of the string. The regular expression regexp defaults to "[ \t]+". ::textutil::trim::trimleft string ?regexp? Remove in string any leading substring according to the regular expression regexp and return the result as a new string. This apply on any line in the string, that is any substring between 2 newline chars, or between the beginning of the string and a newline, or between a newline and the end of the string, or, if the string contain no newline, between the beginning and the end of the string. The regular expression regexp defaults to "[ \t]+". ::textutil::trim::trimright string ?regexp? Remove in string any trailing substring according to the regular expression regexp and return the result as a new string. This apply on any line in the string, that is any substring between 2 newline chars, or between the beginning of the string and a newline, or between a newline and the end of the string, or, if the string contain no newline, between the beginning and the end of the string. The regular expression regexp defaults to "[ \t]+". ::textutil::trim::trimPrefix string prefix Removes the prefix from the beginning of string and returns the result. The string is left unchanged if it doesn't have prefix at its beginning. ::textutil::trim::trimEmptyHeading string Looks for empty lines (including lines consisting of only whitespace) at the beginning of the string and removes it. The modified string is returned as the result of the command. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category textutil of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. SEE ALSO
regexp(3tcl), split(3tcl), string(3tcl) KEYWORDS
prefix, regular expression, string, trimming CATEGORY
Text processing textutil 0.7 textutil::trim(3tcl)
All times are GMT -4. The time now is 10:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy