Text indexer search tool which can filter by punctuation?

308 Views Asked by At

This is not a programming question per se but a question about searching source code files, which help me in programming.

I use a search tool, X1, which quickly tells me which source code files contain some keywords I am looking for. However it doesn't work well for keywords which have punctuation attached to them. For example, if I search for "show()", X1 shows everything that has "show" in it including the too many results from "MessageBox.Show(.....)" which I don't want to see.

Another example: I need to filter to show ".parent" (notice the dot) and not show everything that has "parent" (no dot) in it.

Anyone knows a text search tool which can filter by keywords that have punctuation? I really prefer a desktop app instead of web based tool like Google (I find it clunky).

I am looking for a tool which indexes words and not a general file searcher like Windows File Explorer.

3

There are 3 best solutions below

0
On BEST ANSWER

The tool from DTSearch.com.

0
On

If you want to search code files efficiently for keywords and punctuation, consider the SD Source Code Search Engine. It indexes each source langauge according to langage-specific rules, so it knows exactly the identifiers, keywords, strings, comments, operators in that langauge and indexes it according to those elements. It will handle a wide variety of languages: C, C++, Java, VB6, C#, COBOL, all at once.

Your first query would be posed as:

I=show - I=MessageBox ... '('

(locate identifiers named "show" but eliminate those that are overlapped by MessageBox leftparen). You second query would be posed as simply

'.' I=parent

See http://www.semanticdesigns.com/Products/SearchEngine/index.html

0
On

It seem to be the job of tools like ctags and cscope.

Ctags is used to index declarations of source files (many languages supported) and Cscope for in-depth c file analysis.

These tools are more suited for a per project use in my opinion. Moreover, you may need to use another tool to use these index, I use vim myself for this purpose, but many text editors use ctags.