Find the missing number in an undelimited string The challenge is to identify the missing number in a string of undelimited integers.

You are given a string of digits (valid input will match the regular expression ^[1-9][0-9]+$).  The string represents a sequence of integers.  For example, 1234567891011.  All numbers in the sequence are in the range from 1 and 2147483647 inclusive.

The sequence is a series of numbers where each number is one greater than its predecessor.  However, this sequence may contain one and only one missing number from the sequence.  It is possible that a given string also contains no missing numbers from the sequence.  The string will always contain at least two numbers from the sequence.

The code must output or return the missing value, or 0 (this is a 0 - not a falsy value) in the event that the no missing values were found.

The following are valid inputs and their output/return:

input                         output    actual sequence (for refrence)
123467                        5         1 2 3 4 _ 6 7
911                           10        9 __ 11
123125126                     124       123 ___ 125 126
8632456863245786324598632460  8632458   8632456 8632457 _______ 8632459 8632460  
123                           0         1 2 3
8632456863245786324588632459  0         8632456 8632457 8632458 8632459  


While all of this is described as a 'string' as input, if the language is capable of handling arbitrarily large numbers (dc and mathematica, I'm looking at you two) the input may be an arbitrarily large number instead of a string if that makes the code easier.

For reference, this was inspired by the Programmers.SE question: Find missing number in sequence in string
Haskell, 115 112 bytes

g b|a&lt;-[b!!0..last b]=last$0:[c|c&lt;-a,b==filter(/=c)a]
maximum.map(g.map read.words.concat).mapM(\c-&gt;[[c],c:" "])


The first line is a helper function definition, the second is the main anonymous function.
Verify test cases (I had to run shorter tests because of time restrictions).

Explanation

This is a brute force solution: split the string into words in all possible ways, parse the words to integers, see whether it's a range with one element missing (returning that element, and 0 otherwise), and take the maximum over all splittings.
The range-with-missing-element check is done in the helper function g, which takes a list b and returns the sole element in the range [head of b..last of b] that's not in b, or 0 if one doesn't exist.

g b|                         -- Define g b
    a&lt;-[b!!0..last b]=       -- (with a as the range [head of b..last of b]) as:
    last$0:[...]             --  the last element of this list, or 0 if it's empty:
            c|c&lt;-a,          --   those elements c of a for which
            b==filter(/=c)a  --   removing c from a results in b.
mapM(\c-&gt;[[c],c:" "])        -- Main function: Replace each char c in input with "c" or "c "
map(...)                     -- For each resulting list of strings:
  g.map read.words.concat    --  concatenate, split at spaces, parse to list of ints, apply g
maximum                      -- Maximum of results (the missing element, if exists)