469,278 Members | 2,368 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,278 developers. It's quick & easy.

need help on string matching and tranlastion

dear sir,
i need help in perl program where i want to search a string from paragraph and to convert all the letters in para to X except that string... in this program i have used string matching (regular expresion). i have use like this

Expand|Select|Wrap|Line Numbers
  1. if ($para =~ s/$string/XXXXX/ig) {
  2.  
  3. open MYFILE, ">result.txt";
  4. select MYFILE;
  5.  
  6. print $para ;
  7. print "\n\n";
but here the string will be changing to 'XXXXX'. i need to convert the other letters..pls help anyone... thanks in advance
Feb 25 '09 #1
2 2279
KevinADC
4,059 Expert 2GB
Well, you are telling the regexp to find $string and replace it with XXXXX so its no surprise thats what is happening. Post a before and after example of what you are trying to do and explain anything that is not clear.
Feb 25 '09 #2
Icecrack
174 Expert 100+
here is what i think you want else explain in more detail of what string your matching or why you are trying to XXXX out the rest.


Expand|Select|Wrap|Line Numbers
  1. if ($para !~ m/$string/ig)
  2. {
  3. $para =~ s/$para/XXXXX/ig;
  4. }
  5. elsif ($para =~ m/.$string./ig)
  6. {
  7. print "$para \n\n";
  8. }
Feb 26 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Joh | last post: by
2 posts views Thread by s | last post: by
10 posts views Thread by javuchi | last post: by
2 posts views Thread by Rob | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.