Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > > I have a list of names, separated by the '/' character in a variable, $list, > and a name in the variable $name. If the name appears in the list, I want to > remove it and clean up $list. It takes me 4 calls to s///, and it looks > clunky. I have a feeling that some

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread Jason Tiller
Hi, Mark, :) On Wed, 11 Dec 2002 [EMAIL PROTECTED] wrote: > I have a list of names, separated by the '/' character in a > variable, $list, and a name in the variable $name. If the name > appears in the list, I want to remove it and clean up $list. It > takes me 4 calls to s///, and it looks clu

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread Tanton Gibbs
> I apologize for the confusion, that was in response to Frank's suggestion > that didn't have the leading '/' question-marked. Sorry...I misunderstood your OP...here is a solution that should work $list =~ s!(/)?\b$name\b(/)?!$2 ? ($1||'') : ($2||'')!e; Tanton -- To unsubscribe, e-mail: [EM

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread MarkAllanAnderso
In a message dated 12/11/2002 12:27:41 PM Pacific Standard Time, [EMAIL PROTECTED] writes: > > If it's on the front, it won't remove it because it doesn't have a > preceeding > > / in that case. > > 'm confused...according to your first post: I apologize for the confusion, that was in response

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread Tanton Gibbs
> If it's on the front, it won't remove it because it doesn't have a preceeding > / in that case. I'm confused...according to your first post: >$list =~ s|$name||; # remove $name from the list if it's in the list >$list =~ s|//|/|; # if $name was in the middle of the list, it would have >left beh

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread MarkAllanAnderso
In a message dated 12/11/2002 12:00:43 PM Pacific Standard Time, [EMAIL PROTECTED] writes: > How about this: > > $list =~ s|/$name||; > $list =~ s|^/||; > > If it's at the end, it will remove the last /. > If it's in the middle it will fill in correctly. > If it's

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread Tanton Gibbs
;[EMAIL PROTECTED]> > Sent: Wednesday, December 11, 2002 3:06 PM > Subject: Re: Removing a name from a list - advanced regexp - TIMTOWTDI > > > > > In a message dated 12/11/2002 11:54:48 AM Pacific Standard Time, > > > [EMAIL PROTECTED] writes: > > > &g

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread Tanton Gibbs
Forget that...this works in all cases: $list =~ s|((?!.)/)\b$name\b/?||; - Original Message - From: "Tanton Gibbs" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 3:06 PM Subject: Re: Removing a name f

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread Tanton Gibbs
> In a message dated 12/11/2002 11:54:48 AM Pacific Standard Time, > [EMAIL PROTECTED] writes: > > > > What about just > > $list =~ s|/?$name/?|| > > If $name appears in the middle of the list, this removes both '/' characters. > This was my first guess as well. Ah, didn't think about that one :)

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread MarkAllanAnderso
In a message dated 12/11/2002 11:54:48 AM Pacific Standard Time, [EMAIL PROTECTED] writes: > What about just > $list =~ s|/?$name/?|| If $name appears in the middle of the list, this removes both '/' characters. This was my first guess as well. > But you should be careful about that in case

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread Frank Wiles
.--[ [EMAIL PROTECTED] wrote (2002/12/11 at 14:49:15) ]-- | | I have a list of names, separated by the '/' character in a variable, | $list, and a name in the variable $name. If the name appears in the | list, I want to remove it and clean up $list. It takes me 4 calls to |

Re: Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread Tanton Gibbs
December 11, 2002 2:49 PM Subject: Removing a name from a list - advanced regexp - TIMTOWTDI > I have a list of names, separated by the '/' character in a variable, $list, > and a name in the variable $name. If the name appears in the list, I want to > remove it and clean up $

Removing a name from a list - advanced regexp - TIMTOWTDI

2002-12-11 Thread MarkAllanAnderso
I have a list of names, separated by the '/' character in a variable, $list, and a name in the variable $name. If the name appears in the list, I want to remove it and clean up $list. It takes me 4 calls to s///, and it looks clunky. I have a feeling that someone out there on this list will k