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 without any
Jorge Almeida wrote:
I'm missing something about Perl's regexp:
1 #!/usr/bin/perl -w
2 use strict;
3 my $s=;
4 $s=~s/\D*//;
5 $s=~s/\D*//;
6 print "$s\n";
When input is 'a123b', I get '123b', but I expected '123'. I know I
can substitute line 4 by '$s=~s/\D*//g;' and comment out lin
On Jun 14, 2007, at 12:49 PM, Jorge Almeida wrote:
Martin was right (and I should have seen it from the start). The "will
go ahead as much as possible" is true only in the sense that the
greatest possible string of non-digits will be selected for deletion.
With '$s=~s/\D*//;' in line 5 that stri
On Thu, 14 Jun 2007, Xavier Noria wrote:
On Jun 14, 2007, at 12:10 PM, Martin Barth wrote:
On Thu, 14 Jun 2007 11:04:51 +0100 (WEST)
Jorge Almeida <[EMAIL PROTECTED]> wrote:
> I'm missing something about Perl's regexp:
>
>1 #!/usr/bin/perl -w
>2 use strict;
>3 my $s=;
>4 $s=
On Jun 14, 2007, at 12:10 PM, Martin Barth wrote:
On Thu, 14 Jun 2007 11:04:51 +0100 (WEST)
Jorge Almeida <[EMAIL PROTECTED]> wrote:
I'm missing something about Perl's regexp:
1 #!/usr/bin/perl -w
2 use strict;
3 my $s=;
4 $s=~s/\D*//;
5 $s=~s/\D*//;
6 print "$s\n";
When in
On Thu, 14 Jun 2007, Martin Barth wrote:
On Thu, 14 Jun 2007 11:04:51 +0100 (WEST)
Jorge Almeida <[EMAIL PROTECTED]> wrote:
I'm missing something about Perl's regexp:
1 #!/usr/bin/perl -w
2 use strict;
3 my $s=;
4 $s=~s/\D*//;
5 $s=~s/\D*//;
6 print "$s\n";
When input is 'a
On Thu, 14 Jun 2007 11:04:51 +0100 (WEST)
Jorge Almeida <[EMAIL PROTECTED]> wrote:
> I'm missing something about Perl's regexp:
>
>1 #!/usr/bin/perl -w
>2 use strict;
>3 my $s=;
>4 $s=~s/\D*//;
>5 $s=~s/\D*//;
>6 print "$s\n";
>
> When input is 'a123b', I get '123b', but
On Jun 14, 2007, at 12:04 PM, Jorge Almeida wrote:
I'm missing something about Perl's regexp:
1 #!/usr/bin/perl -w
2 use strict;
3 my $s=;
4 $s=~s/\D*//;
5 $s=~s/\D*//;
6 print "$s\n";
When input is 'a123b', I get '123b', but I expected '123'.
s/\D+//g;
-- fxn
--
To unsubscr
Glad you got the answer. Next time, please work harder on explaining your
problem so the community can understand what you want and benefit from the
solution.
Somu <[EMAIL PROTECTED]> wrote: I got the answer and its working fine..
Actually i made a TicTacToe
game using Tk. The buttons have are
I got the answer and its working fine.. Actually i made a TicTacToe
game using Tk. The buttons have are like as below:
l o r
m p s
n q t
and i keep adding the character alternatingly to 2 strings.. When any
of the strings reaches length >= 3 then i start checking for any
pattern out of the eight..
Somu wrote:
Actually thats what i was looking for: l.*o.*r
So, if the user entered string is to be matched for 'lpt', then i'll
use l.*p.*t ?
And to match 'npr' i use .*n.*p.*r ?
Somu you need to tell us exactly what match you want, otherwise we can't
tell you whether something will work or
Actually thats what i was looking for: l.*o.*r
So, if the user entered string is to be matched for 'lpt', then i'll
use l.*p.*t ?
And to match 'npr' i use .*n.*p.*r ?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 5/1/07, Somu <[EMAIL PROTECTED]> wrote:
my $input = 'loqr';
if ( $input =~ m!lor!i ) {print 'match'}
how will that match? i want them to match. Thats what i want to do.
You can add the 'q' to the pattern. Is this what you want?
if ( $input =~ /loqr/i ) { print 'match' }
Or you can
Thats where the problem arises
my $input = 'loqr';
if ( $input =~ m!lor!i ) {print 'match'}
how will that match? i want them to match. Thats what i want to do.
by the way, can i get some url where i can get lots of problems and
solutions on regexp. I'm very weak in it..
--
To unsubscribe, e-ma
#!/usr/bin/perl
use strict;
my @Strings = qw(lmn lpt lor mps npr nqt opq rst);
chomp(my $Input = );
my $SortedChars = join "", sort (split //, $Input);
foreach (@Strings)
{
if ($SortedChars =~ /$_/)
{
print "Got a match for $Input with $_\n";
On 5/1/07, Somu <[EMAIL PROTECTED]> wrote:
Hi, i have a matching problem. I get input from the user as a 3-5
character long string consisting of characters from 'l' to 't', and
the chars are always sorted for example, the user enters: 'lrqo'. It
becomes: 'loqr'. But i have to match the modified
2007/5/2, Somu <[EMAIL PROTECTED]>:
Hi, i have a matching problem. I get input from the user as a 3-5
character long string consisting of characters from 'l' to 't', and
the chars are always sorted for example, the user enters: 'lrqo'. It
becomes: 'loqr'. But i have to match the modified string
Gunnar Hjalmarsson wrote:
Can it possibly be that you need to make the first regex
non-greedy?
/\.{4}/s
--^
Or a more plausible explanation is that you are looping over the text
line by line. Maybe you simply need to do:
my $text = do { local $/; <> };
$text =~ s/[^\n]*\.{4}
Hamish Whittal wrote:
(Example 1)
I have the following lines:
This is some text..MBAAAEgAAAQAB
blaah,blaah
=+=+=+=+=+=+=+=+=+=+=+
(Example 2)
but sometimes it looks like this:
This is some text..
MBAAAEgAAAQAoBAAAQKAREDSCETRTBDFS
blaah,blaah
=+=+=+=+=+=+=+=+=+=+=+
Now, given this, I am want
> -Original Message-
> From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 18, 2001 9:57 AM
> To: David Simcik
> Cc: Perl Beginners
> Subject: Re: RegExp Problem...
>
>
> On Sep 18, David Simcik said:
> ...
&g
On Sep 18, David Simcik said:
>sub isFacStaff
>{
> my $id = @_;
This is the error: assignment of an array to a scalar returns the number
of elements. You want want one of the following:
my $id = shift;
my ($id) = @_;
my $id = $_[0];
> if($id =~ m/^.+_.+$/i)
You're doing to
On Tue, 18 Sep 2001, David Simcik wrote:
> Hi folks,
> I'm stumped...I wrote a test script and this pattern matches just fine, but
> when I try to use it in another script it does match as it should.
> Basically, if the pattern detects an _ underscore in the string it should
> return undef;
Thanks a ton! I've been working with "Perl, A Beginner's Guide" for a few
days now and referencing the Camel. These scripts will definitely aid me
greatly on the UNIX systems on which I do computational chemistry.
Neema Salimi
[EMAIL PROTECTED]
>= Original Message From [EMAIL PROTECTED]
On Jul 9, saliminl said:
>Hi. This is my first post. I'm trying to write a script that retrieves
>data from a text file. The text files have several hundred instances of
>the string "EAMBER (non-constraint) = #" where the # is a number that
>can be negative and the last spacing after the equal
27 matches
Mail list logo