最大匹配模式 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正則的最小匹配須要在後面加個?號。這裏給本身作一下筆記。