title: how can i write regex for accepting only numbers for antd input
body: <p>I  have to enter only numbers in my antd Input field. But it accepting numbers and alphabets. For my requirement logic is working fine, Except that alphabets. So how can I suppose to write a regex for accepting only numbers?</p>
  
  <pre><code>import React from 'react'
  import * as AntD from "antd";
  import { Input, Tooltip } from 'antd';
  const { Row, Col } = AntD;
  
  function creditCardFormatter(value) {
    var v = value.replace(/\s+/g, '').replace(/[^0-9]/gi, '')
    var matches = v.match(/\d{4,16}/g);
    var match = matches &amp;&amp; matches[0] || '';
    var parts = [];
    for (let i = 0, len = match.length; i &lt; len; i += 4) {
      parts.push(match.substring(i, i + 4));
      console.log(parts)
      console.log(match)}
    if (parts.length){
      console.log(parts.length)
      return parts.join(' ');
    } else {
      return value;
    }
  }
  //     value += '';
  //     const list = value.split('.');
  //     const prefix = list[0].charAt(0) === '-' ? '-' : '';
  //     let num = prefix ? list[0].slice(2) : list[0];
  //     let result = '';
  //     while (num.length &gt; 4) {
  //       result = ` ${num.slice(-4)}${result}`;
  //       num = num.slice(0, num.length - 4);
  //     }
  //     if (num) {
  //       result = num + result;
  //     }  
  //     return `${prefix}${result}${list[1] ? `.${list[1]}` : ''}`;
  // }
  class NumericInput extends React.Component {
  
  
    onChange = (e) =&gt; {
      const { value } = e.target;
      this.props.onChange(creditCardFormatter(value));
    }
  
    render() {
      const { value } = this.props;
  
      return (
  
        &lt;div align="center"&gt;
          &lt;Col push={5}&gt;
            &lt;label&gt;Enter Number Here :&lt;/label&gt;
            &lt;br /&gt;
            &lt;Input
              {...this.props}
              onChange={this.onChange}
              placeholder="Input a number"
            /&gt;
          &lt;/Col&gt;
        &lt;/div&gt;
      );
    }
  }
  
  class InputElement extends React.Component {
    constructor(props) {
      super(props);
      this.state = { value: '' };
    }
    onChange = (value) =&gt; {
      this.setState({ value });
    }
    render() {
      return &lt;NumericInput style={{ width: 120 }} value={this.state.value} onChange={this.onChange} /&gt;;
    }
  }    
  
  export default InputElement
  </code></pre>