line = 'months since 1850-01-01';res = regexp( line, '\s(\d+)-', 'tokens', 'once');year = str2double(res{1})
Standard input is empty
year = 1850
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!