Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In OpenGrok how do you do a full search for special non-alphanumeric characters

Tags:

opengrok

I am trying to search my codebase for code that calls a function named "foo" so I am searching for "foo(" but the results I'm getting includes everything with the word foo in it which includes css, comments and strings that don't even have the trailing open parenthesis.

Anyone know how to do a search for strings that include special characters like ),"'?

like image 743
DiverseAndRemote.com Avatar asked Dec 31 '14 02:12

DiverseAndRemote.com


2 Answers

When searching for special characters, try using escape character before the character, i.e. \, e.g. "foo\(".

Additionally, I found a reply for a similar question (see http://marc.info/?l=opensolaris-opengrok-discuss&m=115776447032671). It seems that frequently occurring special characters are not indexed because of performance issues, therefore it might not be possible to effectively search for such pattern.

like image 199
Quarra Avatar answered Sep 18 '22 18:09

Quarra


Opengrok supports escaping special characters that are part of the query syntax. Current special characters are: + - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

To escape these character use the \ before the character. For example to search for (1+1):2 use the query \(1\+1)\:2

like image 22
melfors Avatar answered Sep 18 '22 18:09

melfors