Today, I just learned, the regular expression is not greedy.

xiaoxiao2021-03-06  78

• The matching mode is non-greed when the character is tightly followed by any other restriction (*, , {n}, {n,}, {n, m}). Non-greedy patterns match the search for strings as little as possible, and the default greed mode is as many as possible to match the search string. For example, for the string "OOOO", 'o ?' Will match a single "O", and 'o ' will match all 'o'.

转载请注明原文地址:https://www.9cbs.com/read-54130.html

New Post(0)