Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use lot of regular expressions. I'm using EditPadpro for all my editing purposes. Most of the time I'll have to extract all the regex matches in the file to another file. Is there any software that can do this?


While working with contacts file. I need to extract all email addresses to another file.

share|improve this question
up vote 5 down vote accepted

RegexBuddy, the sister product to EditPad Pro does this very nicely via it's Grep tab. Will recurse through folders and extract matches to a file. It's also great for building and testing regular expresions.

Use the settings as below:

  • You can add the pre-built email regex from the 'Library' tab
  • Make sure you select the 'Match' button on the top toolbar
  • Enter the file details on the 'Grep' tab and select 'Save results into a single file'

You can test the regex by pasting a section of your file into the 'Test' tab.

  • Press 'Execute' from the 'Grep' drop-down to run.

RegexBuddy screenshot

share|improve this answer
I just downloaded it. But GUI seems to be pretty complex. Can you just tell me in 4 points. What do I need to do in regexbuddy to acheive what I want? – claws Jul 11 '10 at 14:25
Damn it man! I'm probably the world's stupidest man alive. I was using PowerGREP instead of Regex Buddy. – claws Jul 15 '10 at 19:49


share|improve this answer

I'm surprised that no-one noted findstr yet. It has at least rudimentary regular expression support with the /r switch and exists on every semi-recent Windows version (at least down to 2000).

share|improve this answer
It's because almost no one ever hears about these fancy new tools. It almost seems as though Microsoft is actively trying to hide the command line or something... – Ignacio Vazquez-Abrams Jul 11 '10 at 9:12

Install Cygwin, it will give you a very functional unix-like environment on windows. Then learn basic grep, egrep, awk, sed or perl. Time very well invested. Just a few examples:

# extract email addresses from text.txt to emails.txt
egrep -o '[[:alnum:].]+@[[:alnum:].]+' < text.txt > emails.txt
# extract third whitespace separated column from lines starting with "DEBUG"
awk '/^DEBUG/ { print $3 }' < text.txt > debug.txt
# replace multiple whitespace characters with one space
perl -pe 's/[\t ]+/ /g' < text.txt > clean.txt
share|improve this answer

Many Windows text editors (but not notepad) include "Find in Files" functions which support regular expressions.

PowerShell has Select-String which will do regular expression matching.

Or a Windows grep port.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .