[TxMt] regex question

Allan Odgaard throw-away-1 at macromates.com
Wed Feb 22 15:20:56 UTC 2006


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
     ...





More information about the textmate mailing list