\S (viết hoa) khớp một ký tự không phải khoảng trắng (non-whitespace). \S+ khớp từ/token (dãy ký tự non-space liên tiếp).
Ví dụ: search
import re foo = re.search(r'\S+', 'Need for Speed 2') print(foo.group()) # 'Need'
Ví dụ: findall (tách từ)
foo = re.findall(r'\S+', 'Need for Speed 2') print(foo) # ['Need', 'for', 'Speed', '2']
Ứng dụng: Tách token, phân tích log, parsing command line.
Ngược lại: \s khớp whitespace (space, tab, newline...).