in reply to Re: removing C style comments from text files
in thread removing C style comments from text files

so within ysth restrictions, if one wants a one-liner perl -0777 -pe 's{/\*.*?\*/}{}gs' source.c my .02
--
dominix

Replies are listed 'Best First'.
Re: Re: Re: removing C style comments from text files
by ctp (Beadle) on Jan 07, 2004 at 04:05 UTC
    I just tried it and it worked! I've never seen a regex contained in braces before...and what's the deal with the empty braces at the end?

    thanks!
      you can use brace in place of traditional // in match
      m{ } <=> m/ / and in searchreplace s{what}{replace}imsogxe <=> s/what/replace/imsogxe
      in perlretut you have these examples. "/World/", "m!World!", and "m{World}" all represent the same thing. so the empty Brace means "replace with nothing"
      --
      dominix