Re: Regular Expression Question

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 3 May 2010 15:10:42 -0400 (EDT)

In the replacement expression, the backslash is not needed to escape punctuation characters (it would still be needed for, say, a line feed like \n). Use \1 to refer to a group within the search expression, but $1 within the target expression. Thus, try the following replacement expression:


[$1]

Jamal
On Mon, 3 May 2010, Homme, James wrote:

Date: Mon, 3 May 2010 15:03:29 -0400
From: "Homme, James" <james.homme@xxxxxxxxxxxx>
Reply-To: programmingblind@xxxxxxxxxxxxx
To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
Subject: Regular Expression Question

Hi,
I want to take a group of lines. I don't care what they contain. I want to put 
a left bracket in front of them and a right bracket at the end. The thing I 
tried didn't work.

My search expression is:
^(.*)$

My replacement expression is:
\[\1\]

I get only a set of brackets with a space between them.

Jim

Jim Homme,
Usability Services,
Phone: 412-544-1810. Skype: jim.homme
Internal recipients,  Read my accessibility 
blog<http://mysites.highmark.com/personal/lidikki/Blog/default.aspx>. Discuss 
accessibility 
here<http://collaborate.highmark.com/COP/technical/accessibility/default.aspx>.


________________________________
This e-mail and any attachments to it are confidential and are intended solely 
for use of the individual or entity to whom they are addressed. If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it. If you are not the intended recipient, you must not keep, use, 
disclose, copy or distribute this e-mail without the author's prior permission. 
The views expressed in this e-mail message do not necessarily represent the 
views of Highmark Inc., its subsidiaries, or affiliates.

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: