Is there an operator I can use to delete the first n characters from a text?

I’m retrieving a list of texts that looks like this:

  1. long paragraph
  2. long paragraph
  3. long paragraph

And saving them to my database. But I’d like to remove the numbers at the beginning of each item.

Is there an operator similar to the :trimmed operator (which removes the spaces at the beginning and end of the text. For example, ’ fd ’ becomes ‘fd.’) that can remove the first n characters from a text?

In this specific case, you could use :split by '. ': item #2

1 Like

Thanks! Using just the split by '. ' ended up splitting up my paragraphs too, since some of them have periods in them. But I used split by (1. ):split by (2. ):split by (3. )etc. and it worked alright

Ahh, what I meant to say was :split by '. ' minus item: text: split by '. ' first item

But I used split by (1. ):split by (2. ):split by (3. ) etc. and it worked alright

That doesn’t make sense… if you’re going to do that (i.e. you know what you need to remove) then you might as well just use find and replace…

Although you could also use some regex for this (don’t ask me what though)

you can use find & replace with “use regex pattern” checked and nothing for replace.
replace n char at beginning of line: ^[\s\S]{n}
remove numbered list like in your case: ^\d+\.\s*
they both work only for the beginning of the string, so it will not change anything else in the middle.

Cheers
Mariano

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.