In regular expression, i know when use \s to represent a space, but, in following case, would they be different:
thanks a lot if you can explain to me.
The \s character class matches all "whitespace characters," not just spaces. This includes tabs (\t), and if multiline matching is allowed, it includes carriage return (\r) and newline (\n). Theoretically, if your regular expression engine handles unicode, there are also unicode whitespace characters that \s can match, though your mileage may vary.
So with a string like "a\t b", you can match it with the regex /a\s+b/, in case that is useful to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With