Might be trivial, but I do not fully get why the following regex pattern: "\Sa", when applied to the string " a aa", intercepts the first 'a' (in bold) as follows " a aa".
Asked
Active
Viewed 24 times
0
-
2`\S` is **not whitespace** character, so `a` matches `\S`. `\Sa` pattern matches `aa` - *not whitespace* followed by `a`. Please, note, that `\Sa` doesn't match `" a"` since space is a whitespace – Dmitry Bychenko May 31 '19 at 13:44
-
1`\Sa` matches a non whitespace char follwed by `a`. That will match `aa` and not space a – The fourth bird May 31 '19 at 13:44
-
See [**lower** `\s`](https://regex101.com/r/0bTXYX/1). The upper shorthands are usuallly the negation. same like `\d` for digit and `\D` for non digit or `\w` for word character and `\W` for non word character. – bobble bubble May 31 '19 at 13:54