Look ahead, look behind
If a regex needs to look the next/previous character without making it part of the selection (otherwise it will skip it), one can use the look ahead/behind operators. The following example shows how to select any individual characters, at any position, including beginning and end of string:
The group (?!X) looks and ahead for a negative match of X, in this case it is whitespace \w. For a positive mach in the lookahead group, just remove the !. The same applies to the look-behind group, (?<Y).
The above regex would produce the following matches:
d a d das asd r ds sd x x a asd d as s ad d d
Good tutorial here.