Page 1 of 1
Incrementing the string of numbers by one
Posted: Thu Sep 07, 2006 5:29 pm
I have some text files in a directory, I want to batch replace:
In each of the file I have the following text, I want to replace the loan in such a way that the last digit in the loan number is incremented by one
For example in the file that contains the loan number 98573745, after the replace it should show loan number incrementing by one
Posted: Thu Sep 07, 2006 6:11 pm
It's possible to do with Advanced Find and Replace.
One small question.
What should be the resulting text if the load number is:
will it be:
Posted: Thu Sep 07, 2006 6:15 pm
It will be
Basically it should increment by 1
Posted: Thu Sep 07, 2006 6:28 pm
Go to main menu - Action - Options - Batch Replace
uncheck "Modifier S"
check "Modifier I"
check "Modifier M"
check "Modifier G"
check "Modifier E"
Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
That's all I verified it works perfectly.
Additional Similar Batch Replace
Posted: Fri Sep 08, 2006 6:07 pm
Batch replacment for Loan.Number|12345678
Worked. Here is additional Batch replacement I am doing.
Let me know if this looks correct.
I am using
but somehow when I did it, my xml file got corrupted, I could not open them.
I would like to attach my xml file, is there a way I can do it?
Posted: Fri Sep 08, 2006 7:28 pm
For your first example the correct Replace With expression should be:
In fact I forgot to put | char after NUMBER
for your second example, the correct pair is:
So . (dot) and | are reserved chars and you should escape it with \
I think your XML files were corrupted due to incorrect regular
Another think could be:
You should activate using Unicode.
Go to main menu - Action - Options - Advanced:
check "Handle Unicode Files" option.
Posted: Tue Sep 12, 2006 5:17 am
Thank you so much for your help.
One last question if the Loan.Preapp-number begins with a letter then the expression you showed me would not work correct?
What would I use if the value of the Loan.PreApp-number begins with a letter?
Posted: Tue Sep 12, 2006 6:37 am
For this case you should use:
as I already said . and | are reserved chars. So we escape these chars
with \. This escaping is only used for Search For part.
\d means any digit
(Read the Syntax of regular expressions
We use \d+ because we need it to match one or more digits
in the Syntax of regular expressions too).
(\d+) is used because we want to put \d+ into parameter $1 which will be
used later in Replace With part.
Now in Replace with part we use <%= =%> because we need to evaluate
What is inside <%= =%>? Inside we have $1+1. In fact we take the parameter
$1 and increment it by 1. What is $1 parameter? As it's stated above:
$1 is \d+ which means any one or more digits
(an integer number).
That's all. I hope now it will be more clear about how regular