Supposing, I have a string ASDFZXCVQW
, is it possible to capture this into groups of N, and then the remaining characters would be in the final group.
For example, if N were 4, then we could have: ASDF
, ZXCV
, and QW
. Notice how the QW is everything that is left over.
I know how to capture the groups of N with .{N}
, and then manually get the leftover through string indexing, but is it possible to do this in a single regular expression?