> On Feb 17, 2023, at 12:38, Bruce Van Allen <[email protected]> wrote:
> Only happened because I always study your great scripts to learn from them!
Whups I just realized I only tested with lines that would match the find
criteria, so other lines would be excluded.
Here's the fix for that.
#!/usr/bin/env perl -sw
# ----------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2012/11/27 08:12
# dMod: 2023/02/17 12:43
# Task: Encode Spaces in Text Selection for a Given Pattern.
# Tags: @ccstone, @Shell, @Script, @Encode, @Spaces, @RegEx
# Vers: 2.00
# ----------------------------------------------------------
use v5.010;
while (<>) {
if ( m!(.+)(<subject=.+?>)(.+)! ) {
my $prefixStr = $1;
my $newSubject = $2;
my $suffixStr = $3;
$newSubject =~ s!\h!%20!g;
say $prefixStr . $newSubject . $suffixStr;
} else {
print;
}
}
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/9E842A8E-9CDE-4389-8152-7100D945E7DF%40gmail.com.