On 3/2/2004 2:22:15 AM, Christian Ziemski wrote:
>On 3/1/2004 8:04:06 PM, Peter Rejto
>wrote:
>
>
>A simple approach is to (regexp) search
>for "2.1\}".
>But that is a bit inflexible.
>
>A more flexible regular expression could
>be:
>
> Search: 2.1{[^0-9]}
> Replace: 2.2\1
>
>The expression {[^0-9]} matches the
>first non-digit (like you already did),
>but stores it internally as group #1.
>So you can reference it with "\1" in the
>replacement string.
Thanks,
Christian. This is exactly what I missed!
Thanks Pauli,
Now why do I use regular expressions? I have a macro which I use to renumber my equations and this macro uses regular expressions. My previous question was motivated by a rather special case of that macro.
Regular expressions seem to work for me in my macro. In the old days they used to say, "don't change horses midstream".
I adapted it to mean, "don't change notations midstream".
This is not to say that it could not be done simpler using pattern search! Incidentally, how would I program,
replace 2.n by 2.n+1 for n=0,1,2,3,4,5,6,7,8,9.
Thanks again gentlemen,
-peter.
|
|