EmEditor (text editor) Forum Index
   EmEditor Core Enhancement Suggestions
     Extract Text to new document with support for both Find & Replacement Regular Expressions...
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
CrashNBurn
Posted on: 1/17/2011 3:15 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Extract Text to new document with support for both Find & Replacement Regular Expressions...
Merely finding text in a given document (valid regex) is in no way the same functionality as displaying how a given regex breaks up into its various pieces.

These days if a particular regex is being difficult, I'll likely just Run a 3 line AHK script and messageBox the output.
Deipotent
Posted on: 1/17/2011 12:33 pm
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
Re: Extract Text to new document with support for both Find & Replacement Regular Expressions...
Quote:
I dunno about the live-regex/Incremental search for "In Files"
A tool called BareGrep offers live-regex/Incremental search for files, so it's feasible, particularly given the powerful nature of computers these days. Admittedly, an option to disable it should be present though, if not required.

Quote:
But XNews.exe has a very useful tool built-in, "Test Regex"
EmEditor already has this functionality for Find, except it will match against the current document, rather than a Test String. Given this, I don't see a need for a separate "Text RegEx" tool.
CrashNBurn
Posted on: 11/2/2010 12:17 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Extract Text to new document with support for both Find & Replacement Regular Expressions...
I dunno about the live-regex/Incremental search for "In Files"

But XNews.exe has a very useful tool built-in, "Test Regex"

Quote:
Pattern: (Regex Pattern).*(goes here)\.?
Test String: Example string for Regex Pattern to match goes here.
Result: ***Match***
Matched String and sub-expressions:Quote:
00) Regex Pattern to match goes here.
01) Regex Pattern
02) goes here
The dialog has a [Match] and [Close] button, and a [x] Match case, checkbox.
Deipotent
Posted on: 11/2/2010 7:18 am
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
Re: Extract Text to new document with support for both Find & Replacement Regular Expressions...
A few more suggestions related to extract text, plus Find/Replace In Files:

1) Ability to exclude file name from search results (ie. the opposite of the "Display File Names Only" option)

2) Similar to (1), but also option to only show matched/extracted text (ie. not the whole line).

3) Incremental Search option on Find/Replace In Files, which will apply to currently active document, to aid creation of Find Expression without the need to switch to normal Find/Replace windows.

4) Option to leave Find/Replace in Files window open after pressing Find button.
Deipotent
Posted on: 11/2/2010 7:18 am
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
Re: Extract Text to new document with support for both Find & Replacement Regular Expressions...
Further to my suggestion, it would be useful if the Output bar could be used to display the extracted text. Even better, would be if this could be updated in realtime, similar to the incremental search, so you can see immediately the extracted text as the Find/Replacement expression is modified.

This would make it far easier to create the correct Find/Replacement expressions, since it would give immediate feedback on what is matched (ie. the current incremental search feature), along with what is extracted.

While this real-time updating is probably not feasible for Find/Replace in Files with the option "Look in Subfolders" enabled, it could come in handy when the "Look in Subfolders" is not enabled.
Yutaka
Posted on: 10/20/2010 8:58 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2398
Re: Extract Text to new document with support for both Find & Replacement Regular Expressions...
Hello Deipotent and CrashNBurn,

I will consider those options in future versions.
Thanks for your inputs!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

CrashNBurn
Posted on: 10/20/2010 8:52 am
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Extract Text to new document with support for both Find & Replacement Regular Expressions...
Find/Replace should be able to enable the "Output bar" to indicate what should be placed there:
1) All Found Text, and 2) All Replaced Text
or just 2) All Replaced Text.

I thought it was possible, but it appears only the "Find in Files" allows usage of the Output bar for searches.
Deipotent
Posted on: 10/20/2010 5:10 am
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
Extract Text to new document with support for both Find & Replacement Regular Expressions...
One feature I've had the need for recently is the ability to extract text matching a Regular Expression, with the actual text that is extracted matching a Replacement Expression (ie. so you can use back references from the Find RE).

For example, some text I wish to match is as follows:

http://www.emeditor.com/123/321


where the numbers can change. When extracted, I want the numbered parts to be swapped, so in this example, the text extracted to the new document would be:

http://www.emeditor.com/321/123


So, I use the following Find Regular Expression:

http://www.emeditor.com/(\d{3})/(\d{3})


and want to use the following Replacement Expression to extract the text to a new line:

http://www.emeditor.com/\2/\1\n


It would be great if there was an easy way to do this from both the Replace dialog, Replace in Files dialog, and Find bar. For the Replace in Files, it would be handy if there was an option to either put all matches in a single new file, or have separate new documents for each file.

Also, maybe the Find plugin could be extended to become a Find/Replace/Extract plugin.

With this feature, text could be extracted/mined from files.
Threaded | Oldest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文