-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GREP query construction #86
Comments
On Fri, May 15, 2020 at 10:43 PM Emanuel Faria ***@***.***> 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 constru*ctor* and destru*ctor*
\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
<#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...]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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:
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
The text was updated successfully, but these errors were encountered: