Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: trouble with regular expressions

by moritz (Cardinal)
on Nov 06, 2012 at 14:46 UTC ( #1002493=note: print w/ replies, xml ) Need Help??


in reply to trouble with regular expressions

my code s/(\;do.*)(\<\/iframe\>\'\)\;)/sss/; matches only first 4 symbols...

The regex inside your substitution matches the whole string, not "only first 4 symbols", whatever you mean by "symbol".

So, what do you want to do?

Update: The OP silently updated his node, so this reply might or might not be irrelevant now.


Comment on Re: trouble with regular expressions
Download Code
Re^2: trouble with regular expressions
by programmer.perl (Beadle) on Nov 06, 2012 at 14:51 UTC

    I want to change this whole word to //eof

    my old code matches the ;doc and gives result such as ssscument.write('<iframe ...shortened...</iframe>');

    and thank you for your reply ))

    Enough codes make shapes. (Hamidjon)

      sorry, I made a gram. mistake: I want to change this whole string to //eof

      Enough codes make shapes. (Hamidjon)
      my old code matches the ;doc and gives result such as ssscument.write('<iframe ...shortened...</iframe>');

      No, it does not:

      use 5.010; use strict; use warnings; $_ = q[;document.write('<iframe src="any url" scrolling="auto" framebo +rder="no" align="center" height="15" width="15"></iframe>');]; s/(\;do.*)(\<\/iframe\>\'\)\;)/sss/; say __END__ sss

      Anyway, it's easier if you use a different delimiter so that you don't have to escape the forward slashes:

      s{(\;do.*)(</iframe>'\);)}{//eof};

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2014-09-21 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (175 votes), past polls