I tested the command you suggested (,x/\/\*/.,/\*\//) and it works as
I wanted, thanks. But there's something I still don't understand and
is the meaning of that comma in there. As far as I know, the comma is
a  mark that delimits the addresses that acme understands, but I do
not know how a comma is interpreted inside a regexp. I'd really
appreciate if you could clarify this matter to me.

2009/6/26 yy <yiyu....@gmail.com>:
> 2009/6/26 hugo rivera <uai...@gmail.com>:
>> Hi,
>> I am trying to select all c comments from within a file using acme,
>> but I am unable to do it properly. The command x/\/\*.*\*\// is the
>> closest I could get, but it doesn't work with comments that span over
>> more than one line. This raises a question for me: somewhere, I cannot
>> recall where, I read that commands in sam (and therefore acme) aren't
>> line oriented but selection oriented, so, shouldn't '.*' match newline
>> characters also? why it doesn't? I expected '.*' to work with newline
>> characters since it works for spaces and tabs, and the three of them
>> are white space, among others.
>
> You could use (\n|.) to match any character including newlines
> (regex(6) says that a new line is not cosidered "any character", and
> as a matter of fact, \n is part of the sam language, not of regex
> itself). However, since the longest possible regex will be matched,
> then you will also match the end of the comment, so for example in:
> /* comment 1 */
> bar
> /* comment 2 */
> you will match everything, I don't think that is what you want.
>
>> And finally, what command I should use to select c comments without
>> regard if they are several lines long or just one?
>
> Edit ,x/\/\*/.,/\*\//c/COMMENT/
>
> The possibility of modifying the dot is powerful. Many times it is
> much easier than finding an huge regex.
>
>> Saludos
>> --
>> Hugo
>>
>>
>
> Un saludo,
>
>
> --
> - yiyus || JGL .
>
>



-- 
Hugo

Reply via email to