Page 1 of 1

replace option in GREP

Posted: Sun Oct 03, 2010 9:54 pm
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.

Re: replace option in GREP

Posted: Mon Oct 04, 2010 9:04 pm
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.

Re: replace option in GREP

Posted: Tue Oct 05, 2010 3:19 am
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).

Re: replace option in GREP

Posted: Tue Oct 05, 2010 3:47 pm
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.

Re: replace option in GREP

Posted: Wed Oct 06, 2010 11:04 am
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.