Regular expression – regular expression moves the beginning of the string to the end in Notepad

I have a text file like this:

marc_webber
john_grisham
rahmin_darfur
firstname_lastname

I want to output something like this (forget the double name like “van These”):

Webber, Marc, marc_webber
Grisham, John, john_grisham
Darfur, Rahmin, rahmin_darfur
LastName, FirstName, firstname_lastname

So I want to split the string at _, move the last name to the beginning, and separate the first names with commas And connect the name to the end (you can even capitalize the first letter).
It’s easy to use a programming language, but I want to know if I can use the find and replace function of Notepad with regular expressions.
Basically I You need to create variables for the first name and last name, and string them together again at the end.

except for the shell This should work (although testing in the programmer’s notepad…):

Find the pattern:

((\w+)_(\ w+))

Replacement mode:

\3, \2, \1

I have a text file like this:

marc_webber
john_grisham
rahmin_darfur
firstname_lastname

I Hope the output looks like this (forget double names like “van These”):

Webber, Marc, marc_webber
Grisham, John, john_grisham
Darfur , Rahmin, rahmin_darfur
LastName, FirstName, firstname_lastname

So I want to split the string at _, move the last name to the beginning, comma separate the first name and concatenate the name to the end (you can even capitalize the first letter).
It’s easy to use a programming language, but I want I know if I can use the find and replace function of Notepad with regular expressions.
Basically I need to create variables for the first name and last name, and string them together again at the end.

Except for the shell this should work (although testing in the programmer’s notepad…):

Find the pattern:

< pre>((\w+)_(\w+))

Replacement mode:

\3, \2, \1

< /p>

Leave a Comment

Your email address will not be published.