kumar wrote:I have a file in which there is a line:
versionNumber="1.0.0". However, the 1.0.0 is not always the same. So, I need to look for word "versionNumber" and then get the value after "=",extract the first number after doublequote and increment the value. Assumption: it is always numeric after the doublequote.
How can I do this with "TEXTools"?
Please advise.
Sorry I missed seeing yours and the other initial posts to the forum. I thought I had email notification configured. Apparently not.

Anyway, to answer your question, this can be done many different ways but all of the approaches must first isolate the text in order to update it without affecting the surrounding text. Here's one solution:
- Code: Select all
IsolateLines 'versionNumber=' 'versionNumber='
ShiftChars 20 '.'
PadLinesRight ' ' /w29
AppendStr '1'
AddValues 16 30 /i20 /d0 /w0
ReplStr '\s' '' '"\d' '"' /r
EndIsolate
Here's an approach using regular expressions:
- Code: Select all
IsolateLines 'versionNumber=' 'versionNumber='
ReplStr 'versionNumber="(\d+)(.+")' '1 \1 \2' /r
AddValues 1 3 /i1 /d0 /w0
ReplStr '^(\d+)\s\d+\s\d+\s+' 'versionNumber="\1' /r
EndIsolate
... and yet another that uses line rotation:
- Code: Select all
IsolateLines 'versionNumber=' 'versionNumber='
RotCharsLeftStr 1 '\d' /r
ReplStr '\.' ' . ' '^(\d)' '1 \1 ' /r
AddValues 1 3 /i1 /d0 /w0
ReplStr '^(\d+)\s\d+\s\d+\s+' '\1' '\s' '' /r
RotCharsLeftStr 1 'versionNumber'
EndIsolate