CEVOpen
CEVOpen copied to clipboard
GREP query construction
@petermr I need some help...
I’m stuck on how to build a GREP query in TextMate.
I want to search all of the articles in a particular directory for:
- all words ending with *tor (like inhibitor, constrictor, etc)
- and include [x] number of words (or characters, if need be) before after the found terms.
I need to use TextMate because its find/replace preview window a) shows me just results (it hides anything outside my search parameters), and b) it allows me to copy only what is visible in that preview pane and paste into another document where I can work the set I just found.
I've searched around online and found various discussions on on stack overflow etc., but none of them are working for me.
The last one I tried was this:
/(?:)[\*tor]/".{0,5}test_pattern.{0,5}"
But TextMate just says "No results for...."
Looking forward to solving this puzzle.
Manny
On Fri, May 15, 2020 at 10:43 PM Emanuel Faria [email protected] wrote:
@petermr https://github.com/petermr I need some help...
I’m stuck on how to build a GREP query in TextMate.
It's normally capitalized as "grep"
I want to search all of the articles in a particular directory for:
- all words ending with *tor (like inhibitor, constrictor, etc)
- and include [x] number of words (or characters, if need be) before after the found terms.
I need to use TextMate because its find/replace preview window a) shows me just results (it hides anything outside my search parameters), and b) it allows me to copy only what is visible in that preview pane and paste into another document where I can work the set I just found.
I would start small . Use \W (word boundary)
Make an example target like: "constructor destructor and tor and tortuous and contortion"
bring up the "find" widget (CtrlF) and try to following search strings type \Wtor\W matches tor tor\W matches constructor , destructor and tor \Wtor matches tor and tortuous
Then try non-word-boundary \w (BTW you need to be very case-sensitive) \wtor\W matches constructor and destructor \w[^\s]+tor\W matches constructor and *destructor *but not "tor"
Try that, play with TextMate till you can get it right. Then you want to "capture" the matches,
—
You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/petermr/CEVOpen/issues/86, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFTCSZGEKBWQI6Q4GBKMHDRRWZRBANCNFSM4NCSZDTQ .
-- Peter Murray-Rust Founder ContentMine.org and Reader Emeritus in Molecular Informatics Dept. Of Chemistry, University of Cambridge, CB2 1EW, UK
thanks Peter![[selfie-0 uploading...]]