Test, validate and match regular expressions
Matches compass direction strings that begin and end with opposite cardinal directions (N/S or E/W), with only perpendicular directions in between — e.g., 'SWN', 'NEWS', or 'ENSEW'. The four alternatives each cover one axis: S...N, N...S, W...E, and E...W, with the middle constrained to [WE]+ or [NS]+. Useful for validating movement paths, maze navigation sequences, or game direction inputs, with the global flag finding all matches in the text.