regex – Add an underscore after numbers in Notepad++

I have a scenario where I have list with some numbers in Notepad++. Here is the sample text:

1-This is item one
2_This is item two
3This is item three
4_This is item five
5This is item six
6 This is item seven

I want to put an underscore after the numbers so the output is like:

1_This is item one
2_This is item two
3_This is item three
4_This is item five
5_This is item six
6_This is item seven

Here is the code which I have written (\d+)(?!_).(.+?) and replace \1_\2

It is deleting the first character of point 3 and 5, “T” in this case.

Read more here: Source link