On Feb 21, 2006, at 10:50 AM, Oliver Taylor wrote:
ONCE (twice) Three times a lady. Not as much as the Gambler. (This sucks) How would you know?
How do I match the 2nd line but not the 5th? How do I match the 6th, but not he 3rd?
So I just read in the documentation:
[...] it is not possible to use a pattern that matches multiple lines. [...]
Total bummer, although this still may be possible using "begin" and "end"
On 21 Feb 2006, at 20:57, Oliver Taylor wrote:
[...] it is not possible to use a pattern that matches multiple lines. [...]
Total bummer, although this still may be possible using "begin" and "end"
I haven't read that in the documentation - but it /does/ work. I tested the pattern I posted in TM before I posted it.
On Feb 21, 2006, at 3:05 PM, Andy Armstrong wrote:
I haven't read that in the documentation - but it /does/ work. I tested the pattern I posted in TM before I posted it.
Did you test it in a language grammar? It works in the find/replace menu, but I don't think it works in a grammar, which is what the OP wanted.
Oliver: One thing you could try, if these things are hierarchical, is to have a begin pattern for the first line, and ending in something hopefully meaningful. In the rules for the content of that scope, you could have a further begin-end block, which matches the first line there, and in that scope, you could have the content match.... The hard thing is to figure out where these blocks should end. You'd probably want them to all end at the same point, which you might be able to do with look-aheads, once you know where one of them should end.
Not sure if this is possible, depends on the rest of your syntax I guess. But it seems to me that the screenplay should be divided in huge "scene" blocks and such, and you syntax should try to match those blocks as a whole.
Haris
Oliver,
If I may suggest, it would be helpful if you add a test screenplay in the bundle, so that anyone in the future working on it knows how it looks like and what not to break. Like the test.tex we have in the LaTeX bundle.
Haris
So I just read in the documentation:
[...] it is not possible to use a pattern that matches multiple lines. [...]
Not true (if you are talking about find and replace searching).
Enable multiline searching using (?m) the pattern "(?m)get.*Kend" will find one match in the following example text (hit cntrl-cmd-E to open this email in textmate and then select the pattern and hit cmd-E to try it out
Papers to get Newton Morton (Southhampton high IQ geneticist) Eaves et al. 2005 Kendler (and Eaves?) 2005 Extended phenotype
I like this help page for Oniguruma
http://www.jpsoft.com/help/index.htm?regularexpressionsyntax.htm
Other powerful underused options are: (?i) = ignore case (?#greatly simplifies reg ex for words where caps vary) (?# oh yes # allows comments very handy when writing bundles you want to be more explanatory:-)
On 22/2/2006, at 15:09, Timothy Bates wrote:
So I just read in the documentation:
[...] it is not possible to use a pattern that matches multiple lines. [...]
Not true (if you are talking about find and replace searching).
That part was referring to regexps used in a language grammar. The way the language parser works is by matching the patterns line-by-line.
[...] Other powerful underused options are: (?i) = ignore case (?#greatly simplifies reg ex for words where caps vary) (?# oh yes # allows comments – very handy when writing bundles you want to be more explanatory:-)
Not to forget (?x) which enables extended mode, where whitespace is ignored, and comments can be written simply with #. So we can do things like:
(?x) [A-Z]+ # first match one or more capitals \s+ # then match mandatory whitespace ...