Given a regexp A, how do I derive the inverse regexp B such that given any text exactly one of the two regexes will match it.
For example in the below example:
(rx (or (group ---regexpA---) ; a match
(group ---regexpB---))) ; every group of text that's not matched by above
It should be the case that the concatenation of the list of matches should be exactly the contents of the buffer.
(string= (buffer-string)
(let (string)
(while (re-search-forward regexp nil t)
(setq string (concat string
(or (match-string-no-properties 1)
(match-string-no-properties 2)))))
string))