If I knew the name of the Regex feature I needed, I'd have a better title.
As a validation task, I need to verify that a text stream only contains sections matching a Regex pattern I have established, regardless of how many times it occurs. For example, if my pattern is "foo" and I have the string
"foo foofoo"
The result should be three matches and no other non-matching text. Contrarily, the string
"foo foo fooo"
Should return three matches, but I need to detect that a remaining printable character 'o' was not matched. My first though was to use the pipe character for 'or' logic like "(?:foo)|(\S)", and I thought I had it sorted, but the string
"-foo foo foo"
only matches twice. It appears that the leading character causes the engine to skip to the right side of the expression and since it's broadly defined, it captures until the next word break. Clearly my mental representation does not reflect how the engine is operating. Where am I going wrong?