const str = `{getFieldDecorator('remark', { rules: [{ required: true, message: '请认真填写备注信息' }], })(<Input style={{ width: '70%' }} />)}`.replace(/\s*/g,""); const str1 = str.replace('{getFieldDecorator(', "name="); const str2 = str1.replace(',{rules:', " rules={"); const str3 = str2.replace(',initialValue:', "} initialValue={"); const str4 = str3.replace(',}', "}"); console.log(str4.split(')(')[0]);