On Wed Mar 25 2009 @ 3:10, Chas. Owens wrote:
> On Wed, Mar 25, 2009 at 13:21, Telemachus wrote:
> snip
> > my $string2 = 'remove-all-this (Keep this) remove this too';
> >
> > $string2 =~ s/.*\((.*)\)/$1/;
> snip
>
> If $string2 may contain more than one pair of parentheses, you will want
On Wed, Mar 25, 2009 at 13:21, Telemachus wrote:
snip
> my $string2 = 'remove-all-this (Keep this) remove this too';
>
> $string2 =~ s/.*\((.*)\)/$1/;
snip
If $string2 may contain more than one pair of parentheses, you will want to say
$string2 =~ s/.*\((.*?)\)/$1/;
or
$string2 =~ s/.*\(
Rick Bragg wrote:
I need a quick regex to strip out the following:
Never heard of that. What is a quick regex?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.o
On Wed Mar 25 2009 @ 12:19, Rodrick Brown wrote:
> On Wed, Mar 25, 2009 at 12:00 PM, Rick Bragg wrote:
> > I need a quick regex to strip out the following:
> >
> > example:
> > change "remove-all-this (Keep This)" into just "Keep This"
> >
>
> $s =~ s/.*\((.*)\)/$1/;
>
> > something like:
> > s/
On Wed, Mar 25, 2009 at 12:00 PM, Rick Bragg wrote:
> I need a quick regex to strip out the following:
>
> example:
> change "remove-all-this (Keep This)" into just "Keep This"
>
$s =~ s/.*\((.*)\)/$1/;
> something like:
> s/ beginning of line up to and including the first ( //g
> s/ starting fr
I need a quick regex to strip out the following:
example:
change "remove-all-this (Keep This)" into just "Keep This"
something like:
s/ beginning of line up to and including the first ( //g
s/ starting from and including first ) to end of line //g
Can anyone help with this quick line or 2?
Than
Chris Knipe wrote:
(Really just need to get $interface name and $signal)...
Then you may prefer a list slice.
my ($interface, $signal) = (split ' ', $Line)[1,5];
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
Chris Knipe wrote:
Paolo Gianrossi wrote:
Could maybe a simple split(/\s+/ $Line, 7); work?
Almost, but we're not *quite* there yet...
...
I'm not sure why I am required to have 9 fields in the split to get the
values now...
It appears from your initial post as if there is a leading space b
Chris Knipe ha scritto:
>>> # INTERFACE
>>> RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
>>> 0 interface_name radio
>>> 00:0C:42:1F:2C:8D yes -63...@18mbps 9Mbps 2h2m38s
>>>
>>> I'm looking for a
>>> foreach my $Line (@
Chris Knipe wrote:
Hi,
Hello,
I have two lines (well, 1 line is headers, then there follows a range of
data)...
# INTERFACE
RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
0 interface_name radio
00:0C:42:1F:2C:8D yes -
> >
> > # INTERFACE
> > RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
> > 0 interface_name radio
> > 00:0C:42:1F:2C:8D yes -63...@18mbps 9Mbps 2h2m38s
> >
> > I'm looking for a
> > foreach my $Line (@Output) {
> > my (
Chris Knipe ha scritto:
> Hi,
>
> I have two lines (well, 1 line is headers, then there follows a range of
> data)...
>
> # INTERFACE
> RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
> 0 interface_name radio
> 00:0C:42:1F:2C
Hi,
I have two lines (well, 1 line is headers, then there follows a range of
data)...
# INTERFACE
RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
0 interface_name radio
00:0C:42:1F:2C:8D yes -63...@18mbps 9Mbps 2h2m38s
Chris wrote:
> Hi list,
Hello,
> I am not sure if there is a proper name for this but was having some
> difficulty searching for it.
>
> Basically I have data in a file that is between two different
> characters, for example:
>
> # data data
> data
> data data data *
> # more dataaa
> mor *
Chris am Dienstag, 24. Januar 2006 22.35:
> Hi list,
>
> I am not sure if there is a proper name for this but was having some
> difficulty searching for it.
>
> Basically I have data in a file that is between two different
> characters, for example:
>
> # data data
> data
> data data data *
> # mor
On 1/24/06, Chris <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> I am not sure if there is a proper name for this but was having some
> difficulty searching for it.
>
> Basically I have data in a file that is between two different
> characters, for example:
>
> # data data
> data
> data data data *
> #
Hi list,
I am not sure if there is a proper name for this but was having some
difficulty searching for it.
Basically I have data in a file that is between two different
characters, for example:
# data data
data
data data data *
# more dataaa
mor *
Basically I want to slurp that file in, the
Offer Kaye wrote:
On Thu, 31 Mar 2005 13:43:14 -0800, John W. Krahn wrote:
Ah, but there is an important difference - in all the cases I wrote,
the characters following the '@' sign could not be a legal variable
name,
$ perl -le' @) = qw/ a b c d /; print for @) '
Educational thread, this :-)
perld
On Thu, 31 Mar 2005 13:43:14 -0800, John W. Krahn wrote:
> > Ah, but there is an important difference - in all the cases I wrote,
> > the characters following the '@' sign could not be a legal variable
> > name,
>
> $ perl -le' @) = qw/ a b c d /; print for @) '
Educational thread, this :-)
>
>
Offer Kaye wrote:
On Thu, 31 Mar 2005 12:16:21 -0800, John W. Krahn wrote:
And yet in your examples you use @ in double quoted strings four times
without
escaping it (hint: m// and s/// interpolate like double quoted strings.)
Ah, but there is an important difference - in all the cases I wrote,
th
On Thu, 31 Mar 2005 12:16:21 -0800, John W. Krahn wrote:
>
> Using the same regular expression twice is redundant.
> 1 while $str =~ s/(?<=\@)(.+?)_/$1./;
>
Beautiful! But also a bit mind bending. I see code like this and I
think - "too clever". It's not easy, I think, to understand at once
what
On Mar 31, Ramprasad A Padmanabhan said:
$str = "[EMAIL PROTECTED]";
Should become
[EMAIL PROTECTED]
I'd use index() and substr():
if ((my $p = index($str, '@')) > -1) { substr($str, $p) =~ tr/_/./ }
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
Offer Kaye wrote:
Here are 2 other methods, just for the heck of it :-)
# Method 1
my $str = '[EMAIL PROTECTED]';
my ($part1,$part2) = split /@/, $str;
$part2 =~ s/_/./g;
$str = $part1."@".$part2;
print "$str\n";
# Method 2
my $str = '[EMAIL PROTECTED]';
while ($str =~ m/(?<=@).+?_/) {
$str =~ s
ay, March 31, 2005 3:13 PM
Subject: quick regex question
> Hi,
>
> I want to run a substitution for all instances of "_" with "." after
> '@' in a string but "_" before "@" should not be touched.
>
> eg
> $str = "[EM
On Thu, 31 Mar 2005 02:08:22 -0800, John W. Krahn wrote:
>
> $ perl -le'
> my $str = q/[EMAIL PROTECTED]/;
> $str =~ s/([EMAIL PROTECTED])/($a = $1) =~ tr|_|.|; $a/e;
> print $str;
> '
> [EMAIL PROTECTED]
>
> $ perl -le'
> my $str = q/[EMAIL PROTECTED]/;
> substr( $str, index $str, q/@/ ) =~ tr/_
Ramprasad A Padmanabhan wrote:
Hi,
Hello,
I want to run a substitution for all instances of "_" with "." after
'@' in a string but "_" before "@" should not be touched.
eg
$str = "[EMAIL PROTECTED]";
Should become
[EMAIL PROTECTED]
$ perl -le'
my $str = q/[EMAIL PROTECTED]/;
$str =~ s/([EMAI
Hi,
I want to run a substitution for all instances of "_" with "." after
'@' in a string but "_" before "@" should not be touched.
eg
$str = "[EMAIL PROTECTED]";
Should become
[EMAIL PROTECTED]
Any suggestions
Thanks
Ram
--
Netco
irst. If it doesn't, then just
turn
>them into simple variables and use the simple variable instead.
>
>$field_name = $INPUT{field_name};
>
>I'd sure love to see a working example of NET::SMTP, not that you have to,
>but
>I'm sure I would use it.
>
>Gary
Tried the double quotes, but then it ignores the $INPUT{field_name}
altogether, I think maybe something to do with it being HTML, as I have had
it going OK if I just have a simple text message like
$mymessage='this is the field $INPUT{field_name}';
--- Chris Zampese <[EMAIL PROTECTED]> wrote:
>
--- Chris Zampese <[EMAIL PROTECTED]> wrote:
> I have a program that takes input from a form, splits it and saves the values in an
>array -
> $INPUT{field}
> I then create a NET::SMTP mail instance, and message is a string ($mymessage) in
>which I have
> inserted the form values.
> This is so
I have a program that takes input from a form, splits it and saves the values in an
array - $INPUT{field}
I then create a NET::SMTP mail instance, and message is a string ($mymessage) in which
I have inserted the form values.
This is so that I can create a form which when submitted will send a
--- Booher Timothy B 1stLt AFRL/MNAC <[EMAIL PROTECTED]> wrote:
> Hello and thanks so much for your replies, but don't I need a \! To denote a
> literal ! and what about spaces before the bang - don't I want to lose them
> too - what about:
I don't know. Do you want to lose them? Up to you. Yo
: Booher Timothy B 1stLt AFRL/MNAC; [EMAIL PROTECTED]
Subject: Re: quick regex question
--- Booher Timothy B 1stLt AFRL/MNAC <[EMAIL PROTECTED]> wrote:
> o.k. another regex issue . . . I want a one-liner that can remove
everything
> after a given character: i.e.
>
> in
--- Curtis Poe <[EMAIL PROTECTED]> wrote:
> with the caveat that any
> exclamation points that don't mark quotes are going to cause problems.
Ooh. That was coherent.
Time for more caffeine. :)
=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmon
--- Booher Timothy B 1stLt AFRL/MNAC <[EMAIL PROTECTED]> wrote:
> o.k. another regex issue . . . I want a one-liner that can remove everything
> after a given character: i.e.
>
> in this case everything after ! (fortran comment):
>
> would this work:
>
> perl -npe 's/\!.+$//'
>
> my thinking i
--- Booher Timothy B 1stLt AFRL/MNAC <[EMAIL PROTECTED]> wrote:
> o.k. another regex issue . . . I want a one-liner that can remove everything
> after a given character: i.e.
>
> in this case everything after ! (fortran comment):
>
> would this work:
>
> perl -npe 's/\!.+$//'
>
> my thinking i
> -Original Message-
> From: Booher Timothy B 1stLt AFRL/MNAC
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 12, 2001 2:57 PM
> To: [EMAIL PROTECTED]
> Subject: quick regex question
>
>
> o.k. another regex issue . . . I want a one-liner that can
&g
o.k. another regex issue . . . I want a one-liner that can remove everything
after a given character: i.e.
in this case everything after ! (fortran comment):
would this work:
perl -npe 's/\!.+$//'
my thinking is that \! Is the literal character and . would count for
anything + would represent
38 matches
Mail list logo