develooper Front page | perl.beginners | Postings from February 2009

RE: RegExp Problem using Substitutions.

Thread Previous
February 24, 2009 03:31
RE: RegExp Problem using Substitutions.
Message ID:

Try this:


-----Original Message-----
From: Deviloper []
Sent: Tuesday, February 24, 2009 4:03 PM
Subject: RegExp Problem using Substitutions.

Hi there!

I have a string "aaaabbbababbaaassass". I want to get a string without any double a 'aa' or and without the 'b's.

but if I do:

my $s = "aaaabbbababbaaassass";
$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 avoid this. (Using only one substition.))


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About