Some programming languages allow you to specify a function as the replacement
expression. For example you an do this in JavaScript like this.
"1 and a 2".replace(/\d/g, function (match, capture) {
return (parseInt(match)+1);
});
Outputs: "2 and a 3"
In terms of BBEdit you would probably want to look into doing the
search/replace with AppleScript or a shell script.
[fletcher]
> On Nov 6, 2017, at 10:13 AM, Ted Toal <[email protected]> wrote:
>
> Something I've always wanted but never heard mentioned, thought I'd throw out
> the idea here: replacement expressions that include math.
>
> Suppose you have certain integers in your text that you want to ADD ONE TO.
> What if you could capture a matching integer in subexpression \1, then do
> something like this in the replacement:
>
> \e(\1+1)
>
> where \e means an expression in () follows. The expression is evaluated as
> an arithmetic expression, after performing replacement of \1. Result is
> inserted as the replacement text.
>
>
>
> --
> This is the BBEdit Talk public discussion group. 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
> <http://www.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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/bbedit
> <https://groups.google.com/group/bbedit>.
--
This is the BBEdit Talk public discussion group. 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>
---
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.