PeterS
PeterS

Reputation: 724

How to replace word in notepad++ that begins with certain word plus number of bytes

I want to replace that number with format of YYYYMMDDHHMMSS with "".

For example: 20130618100147 SOME TEXT HERE

I tried the to find the 2013(.*)$ in notepad++ (Regular Exp, Wraparound) but every word that next to 2013 deleted in the same line. How can I able to replace only the word starting with 2013 plus the 10 bytes?

Upvotes: 1

Views: 3493

Answers (2)

Milne
Milne

Reputation: 848

(2013\d{10})

This will match and capture the entire string. then you will just need a regex.replace to get rid of it.


Capture anything up until the first occurrence of a space???

(2013\d*\s)

Upvotes: 0

alecxe
alecxe

Reputation: 473863

2013\d{10} will match 2013 and 10 digits after it.

UPD:

Here's a slightly improved version of the regex:

2013[0,1][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-5][0-9]

that will still match, for example, 20130601000000 because it's a valid timestamp.

Upvotes: 2

Related Questions