re = /(.*)\/\/(.*)/m
str = ' id: string;
avatar: string;
name: string; // 名称
brief: string; // 简介
type: string; // ip 形象类型 image:图片类型|figure2d:2d数字人
dubbingId: string; // 默认配音
percent: string; // 比例
previewUseVideo: {
// 预览使用视频
url: string; // 地址
};
coverUrl: string; // 封面url
videoUrl: string;
duration: number; // 时长(s)'
subst = ' /** $2 */ \\n $1'
result = str.gsub(re, subst)
# Print the result of the substitution
puts result
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html