Dr. Onix
Dr. Onix

Reputation: 60

Append text at the beginning of lines that match the regex

I have this file with text:

#EXTINF:9.843,
247.ts
#EXTINF:9.844,
248.ts
#EXTINF:9.843,
249.ts
#EXTINF:9.843,
250.ts
#EXTINF:9.844,

I need to append some text at the beginning of each x.ts line

I tried to use Notepad++, find and replace using regex, but I couldn't make that work.

Upvotes: 0

Views: 91

Answers (2)

Joseph
Joseph

Reputation: 41

To do this, you can try the command line cc.abl <yourText> <lineFilter> of ConyEdit(a plugin).
For Example, with ConyEdit running in the background, copy the text and the command line below:

#EXTINF:9.843,
247.ts
#EXTINF:9.844,
248.ts
#EXTINF:9.843,
249.ts
#EXTINF:9.843,
250.ts
#EXTINF:9.844,
cc.abl 'your text '  /\d+\.ts/

Upvotes: 1

The fourth bird
The fourth bird

Reputation: 163362

Assert the start of the line ^, then capturing in a group one or more digits followed by a dot and ts (\d+\.ts) and assert the end of the line $

^(\d+\.ts)$

In the replacement start with what you want to append followed by group 1:

text$1.

Upvotes: 1

Related Questions