Is there a good free tool out there to search files for matches to a regular expression?

I would like to search all files of a specific extension for matches to this expression: ^ := '([a-z0-9]{3})'$

I would also like it to return (or even better jump to) the line(s) that match.

Anyone know of such a tool?


Agent Ransack will do it.

| improve this answer | |
  • Free version does not have multi-line regex search. Just saying. – Josef Sábl Nov 24 '17 at 10:20

Also look in to AstroGrep, great little program for going just this.

| improve this answer | |

I think you'd want to do something like this:

find / -name *EXTENSION -exec grep "^ := '([a-z0-9]{3})'$" {} \;

It searches the whole drive (/) for any files ending in EXTENSION and then runs grep with your pattern on that file. You can insert any grep flags in there to get more specific behavior, but by default it prints out the file name with its matching line.

As Dan suggests, you can further combine this with sed to actually manipulate the matching files.

| improve this answer | |
  • This will work out of the box if vaccano is running linux. If not, these commands can be run using cygwin. – Jarvin Jul 9 '10 at 18:02

sed("stream editor") will do it. They have Sed for windows as well as for linux (it should be in your package manager if it isn't already in the default install.

| improve this answer | |
  • sed seems an inappropriate answer - it doesn't just find, it modifies. The classic Unix program for regex search is grep, and there are certainly Windows versions around. There will certainly be a version in MSYS - but that's kind of a heavyweight solution if all you want is grep. – Steve314 Jul 9 '10 at 21:40
  • @Steve314: Perhaps it is an overly complex solution... but it works perfectly fine. Sed can for the most part encompasses all of greps functionality and a whole lot more, for example a basic grep done in sed is: 's/pattern/&/p'`. Nerdling's answer of course is much better because it includes the find statement and everything. – Jarvin Jul 9 '10 at 23:07
  • I should have read up on sed again before commenting anyway. Based on vague memories, I thought it edited files in-place. Since it actually edits streams (I should have known really - it's in the name) its a much more sensible answer than I thought. – Steve314 Jul 12 '10 at 19:48

Fastest search tool you will ever see is Everything It does not make index, instead it directly access the NTFS records and find your file without even looking and iterating through your hard drive

It supports regular expression

It is my everytime search tool, it shows the result while you are typing, what can be more faster than that?

| improve this answer | |
  • Interesting, but I don't know that my hard disk is big enough to "Download Everything for Windows 2000, XP, 2003, Vista, 2008 and Windows 7" ;-) – Steve314 Jul 9 '10 at 21:42
  • Looking at the FAQ though - item 1.3 "No, "Everything" does not search file contents, only file and folder names.", which I think means this doesn't answer the question - though the wording of the question isn't clear. – Steve314 Jul 9 '10 at 21:45
  • Its name often confuses while i tell others about it :P , Yup, i am a poor reader and didn't read the last 2 lines of the question with mind. Anyway it will help a lot in your daily file search tasks – LifeH2O Jul 11 '10 at 19:37
  • Everything DOES make an index just not a very big one. – snowdude Jan 25 '12 at 11:09
  • Yes it does make an index, but takes a very little time to do that. – LifeH2O Jan 1 '13 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.