Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: regex: something...(!something)...something

by olus (Curate)
on Jul 17, 2008 at 18:35 UTC ( [id://698408]=note: print w/replies, xml ) Need Help??


in reply to regex: something...(!something)...something

man, you are hard to please

use strict; use warnings; my $text="<tr><td>1</td><td>2</td><td>qw<font>3</font></td><td>4</td>< +tr>"; $text =~ s/<td>((?:(?!<td>).)*)3((?:(?!<\/td>).)*)/$1a$2/; print "$text";

outputs

<tr><td>1</td><td>2</td>qw<font>a</font></td><td>4</td><tr>

Replies are listed 'Best First'.
Re^2: regex: something...(!something)...something
by aaaone (Initiate) on Jul 18, 2008 at 12:35 UTC
    $text =~ s/(<td>)((?:(?!<td>).)*)3((?:(?!<\/td>).)*)/<td>$1$2a$3/;
    Yes! Thank you! It is what I wanted so much :) *I corrected your code a bit, and it seems to work well*

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-25 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found