Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > RegEx variable isolation

Reply
Thread Tools

RegEx variable isolation

 
 
coffeevictim
Guest
Posts: n/a
 
      12-01-2006
Hi,

I have an incorrect regex which seeks to add a column to a CSV file.
The new column always contains a "1" and is always the second to
last column.

My problem is that I don't know how to isolate the $1 from the 1 that
follows it so in my attempt it just looks like $11. Can anyone help?

$SOURCELINE =~ s/(.*,)$2/$11,$2/;

Thanks

coffeevictim

 
Reply With Quote
 
 
 
 
Mirco Wahab
Guest
Posts: n/a
 
      12-01-2006
coffeevictim wrote:

> My problem is that I don't know how to isolate the $1 from the 1 that
> follows it so in my attempt it just looks like $11. Can anyone help?
>
> $SOURCELINE =~ s/(.*,)$2/$11,$2/;
>


$SOURCELINE =~ s/(.*,)/${1}1,/;

Regards

M.


 
Reply With Quote
 
 
 
 
coffeevictim
Guest
Posts: n/a
 
      12-01-2006

Mirco Wahab wrote:
> coffeevictim wrote:
>
> > My problem is that I don't know how to isolate the $1 from the 1 that
> > follows it so in my attempt it just looks like $11. Can anyone help?
> >
> > $SOURCELINE =~ s/(.*,)$2/$11,$2/;
> >

>
> $SOURCELINE =~ s/(.*,)/${1}1,/;
>
> Regards
>
> M.


Cheers M.

cofffeevictim

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How make regex that means "contains regex#1 but NOT regex#2" ?? seberino@spawar.navy.mil Python 3 07-01-2008 03:06 PM
IIS 5.0 Process Isolation Mode Causes System.Web.Mail to Fail nerbanrabbi-brian@yahoo.com ASP .Net 0 04-28-2006 12:42 PM
Classloader isolation and Manifest Class-Path headers ljnelson@gmail.com Java 1 03-31-2006 10:26 PM
ASP.Net Performance better with IIS 6.0 in IIS 5.0 isolation mode =?Utf-8?B?Sm9obiBNY0d1aXJl?= ASP .Net 1 04-15-2005 12:24 AM
ASP.NET Write-access problems with IIS in Worker Process Isolation Mode Jesper ASP .Net 1 08-14-2003 04:58 PM



Advertisments