Regular Expressions for sequences?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Jeff Zollars

Regular Expressions for sequences?

Post by Jeff Zollars »

Hello,

I'm trying to search/replace a series of sequence values, and replace with an incremented value. Say values in the range of 209 to 350 and increment all of the values by 1. So then the sequence values would be 210 to 351.

Textpad's help tries to explain this, but I don't understand. If someone could give me an example it would sure help.

Thanks for the assistance,

Jeff
Carlyle Sutphen

Re: Regular Expressions for sequences?

Post by Carlyle Sutphen »

In your case, you will have to mark the block of text you want to modify from the point where 209 appears to the point where 350 appears. Then searching for
^[0-9]\{3\}
and replacing with
\i(210)
will do what you want if your sequence numbers are immediately at the beginning of the line.

If you are changing a list of file names you still have to mark the block since there is no way to say start from 209 and go to 350. Then you would search for
filename[0-9]\{3\}
and replace with
filename\i(210)
Jeff Zollars

Re: Regular Expressions for sequences?

Post by Jeff Zollars »

Thanks for the assist, it works like a charm.

Jeff
Glenn

Re: Regular Expressions for sequences?

Post by Glenn »

This is way cool.

Are replacement expressions like this "\i" unique to TextPad? Or, are these used in other regular expression syntax. I know that \0-\9 are standard for matching tagged expressions, but are the others?

Glenn
Roy Beatty

Re: Regular Expressions for sequences?

Post by Roy Beatty »

I don't see the \i interpolation mentioned in either Python or Perl documentation. Unfortunately, my copy of Friedl's "Mastering Regular Expressions" is encapsulated in the trunk of my car.

Roy
Post Reply