Revert input's pos when pattern/text match is failed

Fix #13 
Same as #14