The () [] {} of the regular expression has different meanings.
() is to extract a matching string. Several () of the expressions have several corresponding matching strings.
(\s*) A string that represents a contiguous space.
[] is the range of characters that define the match. For example, [a-za-z0-9] represents the corresponding position of characters to match English characters and numbers. [\s*] denotes a space or * number.
{} is typically used to indicate the length of a match, such as \s{3} to match three spaces, \s[1,3] to match one to three spaces.
(0-9) match ' 0-9′ itself. [0-9]* Matching digits (note that there are *, can be empty) [0-9]+ matching digits (note that there are +, not nullable) {1-9} spelling errors.
[0-9] {0,9} represents a numeric string that is 0 to 9 in length.
For example: Filter content in PHP with numbers or spaces
Copy Code code as follows:
Preg_replace ("/\d{1,}\s{0,1}/", "xxxxxxxx", $signaturecontent);
PS: About regular, this site also provides 2 very simple and practical regular expression tool for everyone to refer to use:
JavaScript Regular expression online test tool:
Http://tools.jb51.net/regex/javascript
Regular expression online generation tool:
Http://tools.jb51.net/regex/create_reg