Detect and execute regex-based commands