M
M
MANOWAR882020-09-30 21:15:48
Text Processing Automation
MANOWAR88, 2020-09-30 21:15:48

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

2 answer(s)
D
dollar, 2020-09-30
@MANOWAR88

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;

spoiler
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)

You need to open any sandbox like this one, paste the script, and hit Run. The script will then do all the work. The script itself is written in a few minutes on the knee.

A
Alexander, 2020-09-30
@ForestAndGarden

Copy to Calc / Excel, change the formula there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question