Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Urgent!!! Regular expression??

Reply
Thread Tools

Urgent!!! Regular expression??

 
 
psk
Guest
Posts: n/a
 
      08-13-2003
I need a regular expression for replacing each character in a text
with an X.

For example,

ASASasdfdfDFDFDFDFAAAAAAAAAAAAAAAAAAAAAAABNNBMBMBM BMBBNBJFFFJFFHFFJFJFJJFJFJFJFJFJFJFJFWEWEW

is the initial string i want to replace the 12 A's followed by
something with X's

something like AAAAAAAAAAAAAAAA.* to be replaced by an equal number of
X's

so output should be

ASASasdfdfDFDFDFDFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanx for ur help.
 
Reply With Quote
 
 
 
 
dw
Guest
Posts: n/a
 
      08-13-2003

"psk" <> wrote in message
news: om...
> I need a regular expression for replacing each character in a text
> with an X.
>
> For example,
>
>

ASASasdfdfDFDFDFDFAAAAAAAAAAAAAAAAAAAAAAABNNBMBMBM BMBBNBJFFFJFFHFFJFJFJJFJFJ
FJFJFJFJFJFWEWEW
>
> is the initial string i want to replace the 12 A's followed by
> something with X's
>
> something like AAAAAAAAAAAAAAAA.* to be replaced by an equal number of
> X's
>
> so output should be
>
>

ASASasdfdfDFDFDFDFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX

how about:
$_ =
'ASASasdfdfDFDFDFDFAAAAAAAAAAAAAAAAAAAAAAABNNBMBMB MBMBBNBJFFFJFFHFFJFJFJJFJF
JFJFJFJFJFJFWEWEW';

s/(A{12}.*)/"X" x length $1/e;




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using regular phone as voip device with regular modem? hygum VOIP 5 03-23-2005 03:51 PM
Connect 2 routers (wireless and regular routers) Dineyar Buhariwala Wireless Networking 1 11-24-2004 01:37 PM
can a strongly named assembly reference a regular assembly? Prasanna Padmanabhan ASP .Net 1 11-19-2003 06:21 AM
Custom Regular Expressions in ASP.net Jay Douglas ASP .Net 3 11-03-2003 08:09 PM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57