最大匹配模式

X?      X, once or not at all

X*         X, zero or more times

X+         X, one or more times

X{n}         X, exactly n times

X{n,}         X, at least n times

X{n,m}         X, at least n but not more than m times

最小匹配模式 

X??         X, once or not at all

X*?         X, zero or more times

X+?         X, one or more times

X{n}?         X, exactly n times

X{n,}?            X, at least n times

X{n,m}?         X, at least n but not more than m times


正则表达式写过很多,javascript貌似默认为最小匹配的。一直不知道JAVA正则的最小匹配需要在后面加个?号。这里给自己做一下笔记。