replace option in GREP

Post what you would like to see in future versions

Moderator: vuser

Post Reply
ctammes
Posts: 12
Joined: Thu May 13, 2010 10:16 pm

replace option in GREP

Post by ctammes »

Would it be possible to add a replace option in the FileSearch (GREP) dialog, so that the results that match the regex in the Search textbox are modified to match the replace regex?

Example: I can use a regex to select records from a CSV datafile. But when I only need one or more specific fields, I have to copy the result to an editor and modify them there. It would be nice if I could skip that step and have only those fields in the Results tab instead of the complete line.
FileViewer
Site Admin
Posts: 287
Joined: Fri Apr 30, 2010 5:50 pm

Re: replace option in GREP

Post by FileViewer »

Would it be possible to add a replace option in the FileSearch (GREP) dialog
I made a design decision many years ago that V will not be able to directly modify the contents of files - so I will not be adding any functionality that allows you to replace strings in files.

Is this what you want to do, or do you just want to modify what is displayed in the Results tab so you can then copy it to the clipboard?

If it is the latter, can you give me an example of what you want to do?

Charles.
ctammes
Posts: 12
Joined: Thu May 13, 2010 10:16 pm

Re: replace option in GREP

Post by ctammes »

Charles,

I don't need any editing in existing files, but just modified results.

With Grep and a regex I can select specific records from a file based on a value of a field. When I only need a part of those records, I can select that part by using a subpattern. With a replace option it would be possible to have only the selected subpattern(s) in the Result tab (using $1, $2 or \1, \2).
FileViewer
Site Admin
Posts: 287
Joined: Fri Apr 30, 2010 5:50 pm

Re: replace option in GREP

Post by FileViewer »

With a replace option it would be possible to have only the selected subpattern(s) in the Result tab
So you would like the Text column in the Results tab to display your replace string instead of the whole line.

Is that right?

Charles.
ctammes
Posts: 12
Joined: Thu May 13, 2010 10:16 pm

Re: replace option in GREP

Post by ctammes »

Yes, that is the idea. That way I don't have to use an editor to get the results in the format I want.
Post Reply