Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ regex replace

I have text file full of following lines:

F randomtext F morerandomtext 

what kind of regex I need so that the output would be like this:

randomtext,foo morerandomtext,foo 

so the F becomes foo and moves to the end of line.

Thanks

like image 474
Rabays Avatar asked Dec 11 '11 18:12

Rabays


People also ask

How do you replace regex in Notepad?

A normal “Find and Replace” can't do that, but it's possible with “Regular Expressions”. In Notepad++ press Ctr+H to open the “Find and Replace” window. Under Search Mode: choose “Regular expression” and then check the “matches newline” checkbox. You should see closing </p> tags at the end of each line.

How do you replace a value in notepad?

Open the text file in Notepad. Click Edit on the menu bar, then select Replace in the Edit menu. Once in the Search and Replace window, enter the text you want to find and the text you want to use as a replacement. See our using search and replace and advanced options section for further information and help.

Can I use regex in replace?

How to use RegEx with . replace in JavaScript. To use RegEx, the first argument of replace will be replaced with regex syntax, for example /regex/ . This syntax serves as a pattern where any parts of the string that match it will be replaced with the new substring.

Does Notepad support regex?

It's better to take everything between ( ) cause there may be some variable, not just a string... Notepad don't have regex functionality.


1 Answers

Find:

F (.*) 

Replace all with:

\1,foo 
like image 193
BoltClock Avatar answered Sep 22 '22 00:09

BoltClock