我在JMeter中有一个请求,我想从返回给我的正文中获取一些值。
这是HTML正文返回的一部分:
<input type="hidden" name="__Code" id="__Code" value="53e9d02a-727s-4b13-9w6be-bsfq44a8221251" />
...
<input name="$CpfCnpj" type="text" value="26341646784" maxlength="14" id="CpfCnpj" autocomplete="Off" style="width:200px;" />
...
<a href='javascript:ExibirFilaItemPedido(5101709, false, false);'>198062084</a>
我想获取5101709的值。
我正在尝试通过REGEX Extractor获得此值
但是我得到的值是“(5101709”)。
如果我将REGEX放在“ [0-9] {7,}”,则得到的值是“ 8221251”,而我不想要这个。我不能固定数字5101709,因为这个数字可以更改。有人知道我怎样才能只获得“(”之后的数字?
答案 0 :(得分:2)
您可以使用
import React,{Component} from 'react'
import _ from "lodash"
import PropTypes from 'prop-types'
class HomeUploading extends Component{
constructor(props) {
super(props);
this.state = {
data: null,
event: null,
loaded: 0,
total: 0,
percentage: 10,
}
}
componentDidMount() {
const {data} = this.props;
this.setState({
data: data
});
}
static getDerivedStateFromProps(nextProps,prevState){
const {event} = nextProps;
console.log("Getting an event of uploading", event,prevState);
switch (_.get(event, 'type')) {
case 'onUploadProgress' :
const loaded = _.get(event, 'payload.loaded', 0);
const total = _.get(event, 'payload.total', 0);
const percentage = (total !== 0) ? ((loaded / total) * 100) : 0;
this.setState ({
loaded: loaded,
total: total,
percentage: percentage
});
break;
default:
break;
}
this.setState({
event:event,
}) ;
}
render() {
const {percentage, data, total, loaded} = this.state;
const totalFiles = _.get(data, 'files', []).length;
return (
<div className={'app-card app-card-uploading'}>
<div className={'app-card-content'}>
<div className={'app-card-content-inner'}>
<div className={'app-home-uploading'}>
<div className={'app-home-uploading-icon'}>
<i className={'icon-cloud-upload'}/>
<h2>Sending...</h2>
</div>
<div className={'app-upload-files-total'}>Uploading {totalFiles} files</div>
<div className={'app-progress'}>
<span style={{width: `${percentage}%`}} className={'app-progress-bar'}/>
</div>
<div className={'app-upload-stats'}>
<div className={'app-upload-stats-left'}>{loaded}Bytes/{total}Bytes</div>
<div className={'app-upload-stats-right'}>456K/s</div>
</div>
<div className={'app-form-actions'}>
<button className={'app-upload-cancel-button app-button'} type={'button'}>Cancel
</button>
</div>
</div>
</div>
</div>
</div>
)
}
}
HomeUploading.propTypes={
data: PropTypes.object,
event: PropTypes.object
}
export default HomeUploading;
并将模板设置为[(]([0-9]{7,})
。
$1$
模式匹配[(]([0-9]{7,})
,然后匹配并将捕获到组1(您用(
访问)七个或更多数字。