The question of regular expressions, what does the following regular expression mean?

var re = / quicks (brown). +? (jumps) / ig;
var result = re.exec ("The Quick Brown Fox Jumps Over The Lazy Dog");
(regular expression document from MDN)

quck is a match quick beginning s is a match white space character, (brown) is the first grouping to. +? I don"t understand here. + is one or more of any character. What does this question mark mean?


you'd better give the original content source. Refer to
. If you follow the above explanation, you will not know the relationship between this and

.
    var re = /quicks(brown).*(jumps)/ig;
The difference between

.

the. + here? It should mean lazy matching.

=
confirmed, which means lazy match
here. +? It means to match at least 1 arbitrary character and take as few characters as possible.
such as

var re0 = /quick\s(brown).+?(jumps)/ig;
var re1 = /quick\s(brown).+(jumps)/ig;
var result01 = re0.exec('The Quick BrownJumps Fox Jumps Over The Lazy Dog'); // Quick BrownJumps Fox Jumps  Quick BrownJumpsBrownJumps.+
re0.lastIndex=0;
var result02 = re0.exec('The Quick Brown Fox Jumps Over The Lazy Dog');// Quick Brown Fox Jumps
re0.lastIndex=0;
var result03 = re0.exec('The Quick Brown Jumps Fox Jumps Over The Lazy Dog');//  The Quick Brown Jumps  Quick Brown Jumps Fox Jumps

var result11 = re1.exec('The Quick BrownJumps Fox Jumps Over The Lazy Dog');//  Quick BrownJumps Fox Jumps  Quick BrownJumps Quick BrownJumps .+
re1.lastIndex=0;
var result12 = re1.exec('The Quick Brown Fox Jumps Over The Lazy Dog');//  The Quick Brown Fox Jumps
re1.lastIndex=0;
var result13 = re1.exec('The Quick Brown Jumps Fox Jumps Over The Lazy Dog');// The Quick Brown Jumps Fox Jumps  Quick Brown Jumps
console.log(result01);
console.log(result02);
console.log(result03);
console.log(result11);
console.log(result12);
console.log(result13);

just take a look at the test results.


. +? Say hello, followed by. +, which means the preceding. + combination (any character) is optional.


Let me force a wave of your rules, according to my personal understanding.
quicks, there is nothing to say but match quicks

(brown). What it means is: brown is followed by any character, which is called a
(brown). + for convenience, which means that there is at least one a, and there can be more than one. It is called b
(brown). + for convenience. It means that a match can be satisfied with a b or no b.

as for the last (jumps), it is jumps
I: ignore case
g: global match

to sum up: the string that satisfies the match must first have a quicks, then a b or no b, and finally a jumps

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ae25-2c246.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ae25-2c246.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?