求大神帮忙写个正则表达式

我想替换掉Eclipse面实体类的注解,如何用正则表达式,匹配如下内容

替换掉

/** 开头

*/ 结尾

例如:

     /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column GC_SECCHECK_EVERYDAY_FILE_LOG.ID
     *
     * @mbggenerated Tue Jan 03 13:19:09 CST 2017
     */

我需要一个正则匹配这些垃圾注解,然后我就可以把他们替换掉了

完成实体类,如何才能用正则匹配注释

 public class TempType{
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column GC_TEMP_TYPE.TEMP_TYPE_ID
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    private String tempTypeId;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column GC_TEMP_TYPE.TEMP_TYPE_NAME
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    private String tempTypeName;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column GC_TEMP_TYPE.IS_DEL
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    private String isDel;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column GC_TEMP_TYPE.CREATE_TIME
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    private String createTime;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column GC_TEMP_TYPE.TEMP_TYPE_ID
     *
     * @return the value of GC_TEMP_TYPE.TEMP_TYPE_ID
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    public String getTempTypeId() {
        return tempTypeId;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column GC_TEMP_TYPE.TEMP_TYPE_ID
     *
     * @param tempTypeId the value for GC_TEMP_TYPE.TEMP_TYPE_ID
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    public void setTempTypeId(String tempTypeId) {
        this.tempTypeId = tempTypeId;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column GC_TEMP_TYPE.TEMP_TYPE_NAME
     *
     * @return the value of GC_TEMP_TYPE.TEMP_TYPE_NAME
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    public String getTempTypeName() {
        return tempTypeName;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column GC_TEMP_TYPE.TEMP_TYPE_NAME
     *
     * @param tempTypeName the value for GC_TEMP_TYPE.TEMP_TYPE_NAME
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    public void setTempTypeName(String tempTypeName) {
        this.tempTypeName = tempTypeName;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column GC_TEMP_TYPE.IS_DEL
     *
     * @return the value of GC_TEMP_TYPE.IS_DEL
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    public String getIsDel() {
        return isDel;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column GC_TEMP_TYPE.IS_DEL
     *
     * @param isDel the value for GC_TEMP_TYPE.IS_DEL
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column GC_TEMP_TYPE.CREATE_TIME
     *
     * @return the value of GC_TEMP_TYPE.CREATE_TIME
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    public String getCreateTime() {
        return createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column GC_TEMP_TYPE.CREATE_TIME
     *
     * @param createTime the value for GC_TEMP_TYPE.CREATE_TIME
     *
     * @mbggenerated Fri Dec 23 09:45:15 CST 2016
     */
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

3个回答

自己写出来了

在eclipse下使用这个即可匹配无效的垃圾注释

 (.*)\*(.*)
 (?is)(?<=\/\*\*)*?(?=\*\/)
u013179958
CSDNRGY 不行哎!
接近 3 年之前 回复

注解每行都是一样的,多分几步吧

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!