Answer the question
In order to leave comments, you need to log in
How to replace number 1 with digit order 1 to 366?
Good evening.
There is text, you need to replace all 1 with numbers in order (from 1 to 365), of course, taking into account spaces and tabs in the text.
{
"predict_UNIQUAL_number": 1,
"text": "Удача придет откуда не ждете."
},
{
"predict_UNIQUAL_number": 1,
"text": "Давние долги будут возвращены вам."
},
{
"predict_UNIQUAL_number": 1,
"text": "Вас ожидает неожиданное денежное поступление."
},
{
"predict_UNIQUAL_number": 1,
"text": "Все неоконченные дела будут завершены."
},
Answer the question
In order to leave comments, you need to log in
Regulars are not designed for this in text editors.
But if the text itself is code (for example, js), then instead of units you can insert:
x++
And at the very beginning of the script
Another option is to write your own separate temporary script in any simple language that will do all the work on the text. On the same js or which language you know well.
UPD: Here is an example Lua script that does the substitution:
var x = 1;
s =
local x,n = 0,1
repeat
x = s:find('1', x+10, true)
if x == nil then
break
end
s = s:sub(1,x-1) .. n .. s:sub(x+1,#s)
n = n + 1
until false
print(s)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question