Thank you very much Chris. I thought Perl would do the trick but I was not willing to explore that because of my lack of knowledge of Perl. I checked sed and found that there as a hack that allowed to do that.
The original files were XML where the tags were: <variable1>first string</variable1> There were 2 sets but for some reason one set was shifted and it came like: <variable1>second string</variable1>. I thought about regex to restore the string order but eventually I decided to use brutal force and remove all the figures altogether and use dedicated tool to recreate a normal file... The sed hack could be adapted to BBEdit though... http://www.gnu.org/software/sed/manual/sed.html#Increment-a-number (Bruno Haible is also the CLISP project founder). Jean-Christophe > On Mar 31, 2015, at 20:13, Christopher Stone <[email protected]> > wrote: > > On Mar 31, 2015, at 02:09, Jean-Christophe Helary > <[email protected]> wrote: >> Is there a way to do something like this: >> >> search for (\d) >> replace by \1+1 > ______________________________________________________________________ > > Hey Jean-Christophe, > > As far as I know regex cannot be made to do that, but through the magic of > Perl... > > #! /usr/bin/env perl > use strict; use warnings; > #---------------------------------------- > > while (<>) { > s/\d+/@{[$&+1]}/g; > print; > } > > See this page on StackOverflow for discussion. -- 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].
