At 21:06 -0300 27/10/11, Francisco A. Hirsch wrote:

Say I have the following lines that appear multiple times in a text:
<code>
<caption>irrelevant</caption>
<tr><td>something 1</td><td>something 2</td>É<td>something n</td></tr> </code> I want to replace all of the "td" with "th" using a TextFactory (it's part of a TextFactory)
Is it possible?

Yes, just use a switch:

#! /usr/bin/perl
use strict;
my $switch_on;
while (<>) {
  $switch_on = 1 if /<caption>/;
  $switch_on = 0 if s/td>/th>/g;
  print;
}
__END__

JD

--
You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to