开发者

Ruby regexp help

开发者 https://www.devze.com 2023-01-22 23:41 出处:网络
I need help to remove the string /* s */ (comments in .c and .h files) from some files using Ruby. Is it correct to use gsub to do this. I know 开发者_运维技巧that this string is always placed at the

I need help to remove the string /* s */ (comments in .c and .h files) from some files using Ruby. Is it correct to use gsub to do this. I know 开发者_运维技巧that this string is always placed at the beginning av a line.

thx.


str.gsub(/^\/\*.*?\*\// , '')

Doesn't look nice, but should do it.

0

精彩评论

暂无评论...
验证码 换一张
取 消