

Which position in the string caused the regular expression to fail? - joeframbach
http://stackoverflow.com/a/23839795/1253312

======
Someone
I think there is a simple and obvious way to define that position.

"the longest prefix string of the input where a suffix exists that would cause
the regex match to succeed" is well-defined and easily determined (by looking
at the characters a normal regex engine inspects during matching).

The character after that should be the asked for offset. That could be one
more than the length of the string, for example when looking for a digit in a
string that doesn't contain one.

