Does Mellel have the ability to find instances of two words when they are not adjacent to each other, but rather separated by other words?
What I would like to do is find every instance in which "word 1" is found in the same sentence as "word 2". I am imagining a command that tells mellel to find all instances where "word 1" is within, say 8 words of "word 2".
So, imagine that I want to find every instance in which the names "Bob" and "Cindy" occur in close proximity, but not when they occur alone. The command should allow me to find, for example, the following sentence: "Yesterday, Bob was walking down the street when he met Cindy," but exclude "Bob woke up late this morning and missed the bus."
If anyone can tell me if this is possible, I'd appreciate it - and please let me know if I'm being unclear!
Using "find" to search for words separated by several others
Moderators: Eyal Redler, redlers, Ori Redler
-
- Got the styles thing figured out
- Posts: 7
- Joined: Tue Jul 10, 2007 7:20 pm
-
- Knows everything, can prove it
- Posts: 980
- Joined: Wed Oct 26, 2005 12:48 am
- Location: IE, CA, USA
Re: Using "find" to search for words separated by several others
Yes, it is possible. Something maybe like:
The challenge is in creating a regex that Mellel understands that will give you the intermediate words, but will restrict the search to within a sentence. I'm not certain how best to do it, but perhaps looking at some regex tutorials online might give some help. Then, the regex could be easily transformed into an expression that Mellel understands.
Hope this helps, or offers some suggestions. (A nested expression for the intermediate words might be necessary.)
Code: Select all
{Bob}{space}({characters w/o WS}{space})(1-8 times){Cindy}{characters}{period}
Hope this helps, or offers some suggestions. (A nested expression for the intermediate words might be necessary.)
— Robert Cameron
-
- Knows everything, can prove it
- Posts: 980
- Joined: Wed Oct 26, 2005 12:48 am
- Location: IE, CA, USA
Re: Using "find" to search for words separated by several others
I just looked at Mellel's Find dialog, and came up with something that might work:
Basically, the steps to create this are:
Code: Select all
Bob{Word boundary}{Group: {Any character}(Once or more, not greedy){Word boundary}}(Repetition: Min, 1; Max, 8)Cindy
- Bob
- Insert element: Word boundary
- Insert element: Any character; Repetition: Once or more
- Insert element: Word boundary
- Group items: Any character + Word boundary; Repetition: Range, Min: <How close can they occur>, Max: <How far apart is too far>
- Cindy
— Robert Cameron
-
- Got the styles thing figured out
- Posts: 7
- Joined: Tue Jul 10, 2007 7:20 pm
Re: Using "find" to search for words separated by several others
Thanks a lot, Patrick, I really appreciate it! I'll start playing around with it and see how it goes.