Dan Sharp | 8 Jul 2004 05:29
Picon

Re: mapping '[[' and '[[' keys for Oracle SQL files

David Fishburn wrote:

> So I have a regex question.
> 
> In Oracle syntax you would have:
> 
> procedure dave ....
> begin
> end;
> 
> function bob
> begin
> end;
> 
> In ANSI languages you would have:
> 
> create procedure dave ....
> begin
> end;
> 
> create function bob
> begin
> end;
> 
> 
> So I wanted to create a regex that finds:
> a) lines beginning with optional whitespace
> b) followed by either:
>            procedure or function
>      or the above can be preceeded by 
>            create
> 
> That part I can handle OK:
> map <buffer> [[ call
> search('\(^\s*create\s\+\)\?\<\(function\|procedure\|event\)\>', 'bW' )    

I think it will work if you move the ^\s* outside the \(create\s\+\)\?, 
like:

map <buffer> [[ call 
search('^\s*\(create\s\+\)\?\<\(function\|procedure\|event\)\>', 'bW' )

That should match your two requirements a little more closely.

Dan Sharp


Gmane