Reputation: 11389
In one tutorial, there is text like this:
Windows 1.03 and Windows 2.0 fisrt Released in 1985 and 1987 respectively. Windows 95 and Windows 98 are the successor. Then Windows 2000 and Windows Xp appeared. Windows Vista is the Latest version of the family.
It uses Windows [\d.]+\b
to match, but why the result is only
Windows 1.03
Windows 2.0
Windows 95
Windows 98
Windows 2000
I wonder what [\d.]
means?
Upvotes: 1
Views: 62
Reputation: 48546
\d
means any digit. So [\d.]
is the same as [0-9.]
and will match any digit, or a period.
Note that .
usually means "anything except \n
", but inside a character class ([]
), it just means the actual period character.
The only special characters inside a character class are:
^
at the beginning, to mean "not these characters"]
to mark the end (unless it comes first)-
to mark a range (unless it comes first or last)\x
for an escape sequence (though this depends on the particular engine)[:foo:]
for POSIX character classes (which again depends on the engine)Anything else is just a regular character.
Upvotes: 2