Search code examples
regexnotepad++text-editortextpad

Regular expression in text editor


I have a requirement to replace all the below numbers to TAB in text Editors like notepad++. I tried the below regular expression but it still needs some manually work. Can anyone help to achieve this in single regular expression.

I used the below one and manually removed the [1-9]. factor to get all the lines.

\<3.1.[1-9].[1-9].[1-9].

3.1. Cre
3.1.1. Im
3.1.1.1. O
3.1.1.2. Ce
3.1.1.3. Part
3.1.2. ED
3.1.2.1. Ow
3.1.2.2. ED
3.1.3. OF
3.1.3.1. O
3.1.3.2. O
3.1.3.3. O
3.1.3.4. O
3.1.4. Sc
3.1.5. In
3.1.6. Vi
3.1.7. Bu
3.1.8. Ho
3.1.8.1. Ou
3.1.8.2. In
3.1.9. Pa
3.1.9.1. Re
3.1.9.2. Re
3.1.9.3. Pr
3.1.9.3.1. Ou
3.1.9.3.2. Sp
3.1.9.3.3. In
3.1.9.3.4. In


Solution

  • Search for

    ^3[.1-9]+\s

    and replace with

    \t

    It works in NotePad++ on my computer.

    UPDATE: A more generic regex in NotePad++ for bullet point removal:

    Search: ^[.0-9]+\s([A-Z])

    Replace with \t\1