Deviloper wrote:
> Hi there!
>
> I have a string "bbbababbaaassass". I want to get a string without any
> double a 'aa' or and without the 'b's.
>
> but if I do:
>
> my $s = "bbbababbaaassass";
> $s=~ s/aa|b//g;
>
> as a result I will get a string "aaassass".
>
> (I understand WHY I g
John W. Krahn wrote:
Deviloper wrote:
Hi there!
Hello,
I have a string "bbbababbaaassass". I want to get a string without
any double a 'aa' or and without the 'b's.
but if I do:
my $s = "bbbababbaaassass";
$s=~ s/aa|b//g;
as a result I will get a string "aaassass".
(I understand
Deviloper wrote:
Hi there!
Hello,
I have a string "bbbababbaaassass". I want to get a string without
any double a 'aa' or and without the 'b's.
but if I do:
my $s = "bbbababbaaassass";
$s=~ s/aa|b//g;
as a result I will get a string "aaassass".
(I understand WHY I get this result.
Try this:
$s=~s/b|ab*a//g;
-Original Message-
From: Deviloper [mailto:devilo...@slived.net]
Sent: Tuesday, February 24, 2009 4:03 PM
To: beginners@perl.org
Subject: RegExp Problem using Substitutions.
Hi there!
I have a string "bbbababbaaassass". I want to get a string w
Hi there!
I have a string "bbbababbaaassass". I want to get a string without any
double a 'aa' or and without the 'b's.
but if I do:
my $s = "bbbababbaaassass";
$s=~ s/aa|b//g;
as a result I will get a string "aaassass".
(I understand WHY I get this result.
But I don´t know how to av
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hey,
Ah thanks, that's just what I needed :)
I haven't been using m and g together, that was the problem.'
Thanks alot.
Mads
Xavier Noria wrote:
| On Jul 4, 2005, at 19:25, Mads N. Vestergaard wrote:
|
|> My string is "footest test testbartest te
Mads N. Vestergaard [MNV], on Monday, July 04, 2005 at 19:25 (+0200)
wrote the following:
MNV> My string is "footest test testbartest test
MNV> testbaztest test test".
I hope this snippet will help you:
use strict;
use warnings;
my $string = qq{footest test testbartest test
test
On Jul 4, 2005, at 19:25, Mads N. Vestergaard wrote:
My string is "footest test testbartest test
testbaztest test test".
What I would like to have is to get foo,bar,baz into an array, I've
tried to substitute it, but it doesn't seem to work for me. Either
I get
foo correct and nothing else, o
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everybody,
I hope you can help me out a bit here.
I'm having some problems with multiple substitutions from a string.
My string is "footest test testbartest test
testbaztest test test".
What I would like to have is to get foo,
On Thu, Nov 18, 2004 at 04:28:40PM +0100, Markus Treinen wrote:
> I can't use strict because I simple add a config-file via require and
> the variables are simply declared (without my or our). And as it gives
> me a lot of warnings, I disabled them, too :-)
I hit this very thing today, so I cheat
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Markus Treinen) writes:
>> Then don't interpolate it beforehand. (Didn't you get a warning
>> about "use of uninitialized value"?)
>I can't use strict because I simple add a config-file via require and
>the variables are simply declared (without
Markus Treinen wrote:
Peter Scott wrote:
Then don't interpolate it beforehand. (Didn't you get a warning
about "use of uninitialized value"?)
I can't use strict because I simple add a config-file via require and
the variables are simply declared (without my or our). And as it
gives me a lot of war
Then don't interpolate it beforehand. (Didn't you get a warning
about "use of uninitialized value"?)
I can't use strict because I simple add a config-file via require and
the variables are simply declared (without my or our). And as it gives
me a lot of warnings, I disabled them, too :-)
But I c
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Markus Treinen) writes:
>Hi,
>I have the following case:
>
>-
>my $reg_exp = qr/^ONE\.(\d{6})\.THREE$/;
>my $replace_with = "FOUR.$1.FIVE";
>
>my $example_file = "ONE.123456.THREE";
>$example_file = s/$reg_exp/$replace_with/;
>-
>
>In word
Hi,
I have the following case:
-
my $reg_exp = qr/^ONE\.(\d{6})\.THREE$/;
my $replace_with = "FOUR.$1.FIVE";
my $example_file = "ONE.123456.THREE";
$example_file = s/$reg_exp/$replace_with/;
-
In words, I want to reuse substrings from the matched string in the
replacement string. Both rege
"Randy W. Sims" wrote:
>
> On 3/8/2004 8:35 AM, Hemond, Steve wrote:
> >
> > In an HP/GL2 file, there is a command called SP (select pen) which is
> > associated to a pen number from 1 to 64. I have to parse the file and
> > insert a command after each select pen command.
> >
> > Example :
> > 106
[EMAIL PROTECTED]
> Sent: Monday, March 08, 2004 8:59 AM
> To: Hemond, Steve
> Cc: [EMAIL PROTECTED]
> Subject: Re: Substitutions
>
>
> On 3/8/2004 8:35 AM, Hemond, Steve wrote:
>
> > Hi ppl,
> >
> > In an HP/GL2 file, there is a command called SP
On 3/8/2004 8:35 AM, Hemond, Steve wrote:
Hi ppl,
In an HP/GL2 file, there is a command called SP (select pen) which is
associated to a pen number from 1 to 64. I have to parse the file and
insert a command after each select pen command.
Example :
10652PUPD515,10652PUPD515,2536PUSP61PU57531,8270P
Hemond, Steve wrote:
Example :
10652PUPD515,10652PUPD515,2536PUSP61PU57531,8270PDPA57
to :
10652PUPD515,10652PUPD515,2536PUSP61;NEW_COMMAND;PU57531,8270PDPA57
My actual way of doing it is :
s/SP(\d*)/SP$1;NEW_
Hi ppl,
In an HP/GL2 file, there is a command called SP (select pen) which is
associated to a pen number from 1 to 64. I have to parse the file and
insert a command after each select pen command.
Example :
10652PUPD515,10652PUPD515,2536PUSP61PU57531,8270PDPA57
Hi ppl,
In an HP/GL2 file, there is a command called SP (select pen) which is
associated to a pen number from 1 to 64. I have to parse the file and
insert a command after each select pen command.
Example :
10652PUPD515,10652PUPD515,2536PUSP61PU57531,8270PDPA57
---
r new values
-Original Message-
From: Adriano Allora [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 29, 2002 5:21 AM
To: [EMAIL PROTECTED]
Cc: Dan Muey
Subject: Re: single quote and substitutions
Venerdì, 27 Dic 2002, alle 20:11 Europe/Rome, Dan Muey ha scritto:
> Have you tried
-Original Message-
From: Adriano Allora [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 27, 2002 1:00 PM
To: [EMAIL PROTECTED]
Subject: single quote and substitutions
Hi to all,
I need to substitute in a text a serie of word with another serie of
word (for example: when I have the name I want
Adriano Allora wrote:
>
> Hi to all,
Hello,
> I need to substitute in a text a serie of word with another serie of
> word (for example: when I have the name I want the correct surname).
> Modifying a someone else script I wrote this one:
>
> #!/usr/bin/perl -w
>
> my $original = '(name1|name2)
Venerdì, 27 Dic 2002, alle 20:11 Europe/Rome, Dan Muey ha scritto:
Have you tried doing the regex without the vars?
s/(name1|name2)/(surname1|surname2)/g;
Does that do what you want?
I'd prefer do not do it in this way, because I don't know how many (and
what kind of) $originals and $news I'l
-Original Message-
From: Adriano Allora [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 27, 2002 1:00 PM
To: [EMAIL PROTECTED]
Subject: single quote and substitutions
Hi to all,
I need to substitute in a text a serie of word with another serie of
word (for example: when I have the name
Hi to all,
I need to substitute in a text a serie of word with another serie of
word (for example: when I have the name I want the correct surname).
Modifying a someone else script I wrote this one:
#!/usr/bin/perl -w
my $original = '(name1|name2)';
my $new = '(surname1|surname2)';
$file_name
Jenda Krynicky wrote:
>
> From: "Steven Arbitman" <[EMAIL PROTECTED]>
>
> > I have a problem which is simple to state:
> >
> > Find all prices in a file, multiply them by 2.5, and print out the
> > file with the new prices.
> >
> > It seemed like a good use for substitution at first.
> >
> > The
Using the /g modifier would be appropriate. Consider using the /e modifier
which causes perl to execute code in the "replace-with" part of the s///.
The following is from the Camel 3rd Ed, page 209:
s/(\d+)/$1 * 2/; #Replaces "42" with "42 * 2"
s/(\d+)/$1 * 2/e; #Replaces "42" with "84"
Chee
From: "Steven Arbitman" <[EMAIL PROTECTED]>
> I have a problem which is simple to state:
>
> Find all prices in a file, multiply them by 2.5, and print out the
> file with the new prices.
>
> It seemed like a good use for substitution at first.
>
> The following successfully finds the prices a
Hi,
I have a problem which is simple to state:
Find all prices in a file, multiply them by 2.5, and print out the file with
the new prices.
It seemed like a good use for substitution at first.
The following successfully finds the prices and saves them in memory:
/\$([0-9.]+)/
(a dollar sign
> Thanks for the help!! Unfortunetly this solution only copies the modified
> line to the tmp file. I need the all the other data to stay unchanged.
> e.g. John:111:0
> Peter:222:0
> Jane:333:0
>
> becomes
>
> John:111:0
> Peter:222:1
> -Original Message-
> From: Patrick Bateman [mailto:[EMAIL PROTECTED]]
> Subject: File substitutions??
>
> Hi everyone
Hi! I'm still pretty new myself, so forgive me for not doing this the
"Perl way".
>
> Need help with this please, pretty please!
"Sudarsan Raghavan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> Patrick Bateman wrote:
>
> > Hi everyone
> >
> > Need help with this please, pretty please!!
> >
> > I open a file containing this:
> > e.g.
> > John:111:0
> > Peter:222:0
> > Jane:
Patrick Bateman wrote:
> Hi everyone
>
> Need help with this please, pretty please!!
>
> I open a file containing this:
> e.g.
> John:111:0
> Peter:222:0
> Jane:333:0
>
> Now I select a particular name from an input.
> Now comes the part I'm having trouble with. For that name I've
Hi everyone
Need help with this please, pretty please!!
I open a file containing this:
e.g.
John:111:0
Peter:222:0
Jane:333:0
Now I select a particular name from an input.
Now comes the part I'm having trouble with. For that name I've selected how
do I increment the count value.
e.
On Jan 15, John W. Krahn said:
>Tim Sargent wrote:
>>
>>Unaltered (straight text) line:
>>---
>>GS5 launches 3 plasma torpedoes (GS5.p1-3), warhead strength 20, speed
>> 32,
>>
>>Formatted line:
>>---
>>GS5 launches 3
>> plasma tor
Tim Sargent wrote:
>
> Hello -
Hello,
>I'm attempting to develop a simple script that will read a text file and
> turn it into an HTML page for me. It's not CGI - I run the script from the
> command line and then upload the resultant file to the web server.
>
>In a nutshell, within th
Tim Sargent wrote:
> I'd prefer an efficient and neat method to do all this,
> but am rather stuck. Any pointers that can get me started down the right
> path would be greatly appreciated...I know there's an answer out there, I'm
> just having a devil of a time finding it. Sorry for the lengthy
Hello -
I'm attempting to develop a simple script that will read a text file and
turn it into an HTML page for me. It's not CGI - I run the script from the
command line and then upload the resultant file to the web server.
In a nutshell, within this text file certain words have a specific
40 matches
Mail list logo