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

RegExp Problem using Substitutions.

Thread Next
From:
Deviloper
Date:
February 24, 2009 02:32
Subject:
RegExp Problem using Substitutions.
Message ID:
1444764526.76666.1235471567426.JavaMail.open-xchange@oxgw01.kundenserver.de
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.))

Thx,
B.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About