Robert Klemme wrote:
> 2009/9/10 7stud -- <>:
>>> function TfrmExecMain.SetPrivilege(PrivilegeName: String;
>>> for example;
>>
>> ENDOFSTRING
>>
>> md = str.match(/function.*?\):\s+(.*?
/m)
>> if md
>> Â*puts md[1]
>> end
>>
>> --output:--
>> Boolean;
>
> Note that you do not need the /m flag for this to match. This works
> the same without it. The only difference that /m makes is whether
> newlines are matched by .:
>
> irb(main):001:0> s = "a\nb\n"
> => "a\nb\n"
> irb(main):002:0> s[/.*/]
> => "a"
> irb(main):003:0> s[/.*/m]
> => "a\nb\n"
>
> It does not make any difference for \s:
>
> irb(main):004:0> s[/\s+/]
> => "\n"
> irb(main):005:0> s[/\s+/m]
> => "\n"
>
> I'll attach an extended example.
>
> Kind regards
>
> robert
Thank you Robert,
Wooow! your code is seen perfect.
I want to ask one more question; my file contains many many functions,
vars and begins like this,
for example;
...
function TfrmExecMain.GetApiErrorMessage(ApiErrCode

WORD) :String;
var
Buf: array[0..511] of Char;
MsgCnt

WORD;
begin
...
function TfrmExecMain.SetPrivilege(PrivilegeName: String;
Enable: Boolean): Boolean;
var
tpPrev,
tp : TTokenPrivileges;
token : THandle;
dwRetLen : DWord;
begin
...
how can I do it with your code?
should I write new regexp for each function?
--
Posted via
http://www.ruby-forum.com/.