antd form + TextArea正则校验指定字母加数字

543 阅读1分钟

正则匹配文本域内逗号分隔的多条指定字母加数字是否合法 ` import React from "react";

import "antd/dist/antd.css";

import "./index.css";

import { Form, Input } from "antd";

\

const { TextArea } = Input;

\

const App = () => {

return (

name="basic"

labelCol={{

span: 8

}}

wrapperCol={{

span: 16

}}

initialValues={{

remember: true

}}

autoComplete="off"

<Form.Item

label="id"

name="id"

rules={[

{

required: true,

message: "Please input your id!"

},

{

pattern: /^cid\d+(,cid\d*)+$/g,

message: "Please enter the correct ID!"

}

]}

</Form.Item> </Form> ); }; \ export default App; \ `