Home > front end >  For added a regular!
For added a regular!

Time:12-04

 
Var val="CREATE TABLE ` inversion_recharge ` (
` ID ` bigint (20) NOT NULL AUTO_INCREMENT,
` orderno ` char (15) NOT NULL DEFAULT 'COMMENT' number ',
` itemcount ` tinyint (4) NOT NULL DEFAULT '0' COMMENT 'prepaid phone number',
` itemmoney ` int (11), NOT NULL DEFAULT '0' COMMENT 'total amount,
` type ` char (1) NOT NULL DEFAULT 'COMMENT' top-up type: 1 prefi lled 2 solid filling ',
` isall ` char (1) NOT NULL DEFAULT 'COMMENT' whether full: 1 than full 2 full ',
` remark ` varchar (200) NOT NULL DEFAULT 'COMMENT' remarks',
` reviewdate ` char (8) the NOT NULL DEFAULT 'COMMENT' audit date,
` reviewtime ` char (6) the NOT NULL DEFAULT 'COMMENT' audit time,
` status ` char (1) NOT NULL DEFAULT 'COMMENT' collection status: 1 NOT the receivable part 2 has the receivable collection ',
` reviewstatus ` char (1) NOT NULL DEFAULT '1' COMMENT 'approval status: 1 to 2 has passed 3 has refused to 4 have been withdrawn',
` datastatus ` char (1) NOT NULL DEFAULT '1' COMMENT 'data state 0/1 disabled enable'
` createuser ` bigint (20) NOT NULL DEFAULT '0' COMMENT 'founder,
` createdate ` char (8) the NOT NULL DEFAULT 'COMMENT' creation date,
` createtime ` char (6) the NOT NULL DEFAULT 'COMMENT' creation time,
` updateuser ` bigint (20) NOT NULL DEFAULT '0' COMMENT 'update people',
` updatedate ` char (8) the NOT NULL DEFAULT 'COMMENT' updated '
` updatetime ` char (6) the NOT NULL DEFAULT 'COMMENT' update time,
` syscreatetime ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'record creation time,
` sysupdatetime ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'record last UPDATE time,
The PRIMARY KEY (` ID `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='generation top-up' ";


Var res=val. Match (/\ ` [\ w_] + \ ` \ s + [\ w_ \] (\) + (+ | \ \ s,)/g);




Now the result is like this:


Hope the contents of the array after each element behind keep up with the COMMENT!
The second element, for example, hope is like this:
` orderno ` char (15)//order
Pay attention to the space attention to Spaces note space

CodePudding user response:

\ '[\ u4e00 - \ u9fa50-9 \ \ s:] + \'
This can be matched to the contents of the comment after

CodePudding user response:

reference 1st floor cjhelloworld response:
\ '[\ u4e00 - \ u9fa50-9 \ \ s:] + \'
This can be matched to the comment after the content of the

And the end of each line after the COMMENT before

CodePudding user response:

reference 1st floor cjhelloworld response:
\ '[\ u4e00 - \ u9fa50-9 \ \ s:] + \'
This can be matched to the comment after the content of the


Do not match the ~

CodePudding user response:

Want to get is: ` orderno ` char (15)//order no Spaces, no single quotation marks?
Then you need to take the replace match later,
Regular has always been weak, could not write a high quality, but can "stack"

CodePudding user response:

The top! The top!

CodePudding user response:

 
Var val=` CREATE TABLE \ ` inversion_recharge \ ` (
\ \ ` ` ID bigint (20) NOT NULL AUTO_INCREMENT,
\ ` orderno \ ` char (15) NOT NULL DEFAULT 'COMMENT' number ',
\ ` itemcount \ ` tinyint (4) NOT NULL DEFAULT '0' COMMENT 'prepaid phone number',
\ ` itemmoney \ ` int (11), NOT NULL DEFAULT '0' COMMENT 'total amount,
\ ` type \ ` char (1) NOT NULL DEFAULT 'COMMENT' top-up type: 1 prefi lled 2 solid filling ',
\ ` isall \ ` char (1) NOT NULL DEFAULT 'COMMENT' whether full: 1 than full 2 full ',
\ ` remark \ ` varchar (200) NOT NULL DEFAULT 'COMMENT' remarks',
\ ` reviewdate \ ` char (8) the NOT NULL DEFAULT 'COMMENT' audit date,
\ ` reviewtime \ ` char (6) the NOT NULL DEFAULT 'COMMENT' audit time,
\ ` status \ ` char (1) NOT NULL DEFAULT 'COMMENT' collection status: 1 NOT the receivable part 2 has the receivable collection ',
\ ` reviewstatus \ ` char (1) NOT NULL DEFAULT '1' COMMENT 'approval status: 1 to 2 has passed 3 has refused to 4 have been withdrawn',
\ ` datastatus \ ` char (1) NOT NULL DEFAULT '1' COMMENT 'data state 0/1 disabled enable'
\ ` createuser \ ` bigint (20) NOT NULL DEFAULT '0' COMMENT 'founder,
\ ` createdate \ ` char (8) the NOT NULL DEFAULT 'COMMENT' creation date,
\ ` createtime \ ` char (6) the NOT NULL DEFAULT 'COMMENT' creation time,
\ ` updateuser \ ` bigint (20) NOT NULL DEFAULT '0' COMMENT 'update people',
\ ` updatedate \ ` char (8) the NOT NULL DEFAULT 'COMMENT' updated '
\ ` updatetime \ ` char (6) the NOT NULL DEFAULT 'COMMENT' update time,
\ ` syscreatetime \ ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'record creation time,
\ ` sysupdatetime \ ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'record last UPDATE time,
PRIMARY KEY (\ \ ` ` ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='generation top-up' `;

Var res=[];
Val. Replace (/(\ ` \ w + \ `) \ s + ([\ w \ (\)] +) (? : \ s + +? The COMMENT \ s + '(. +?) ')?/g, function ($0, $1, $2, $3) {
Res. Push ($1 + "" + $2 + ($3?"//"+ $3:" "));
The return of $0;
});
console.log(res);
  • Related