Abstract: The invention refers to a method for text recognition, wherein the method is executed by a processor of a computing device and comprises steps of providing a confidence matrix, wherein the confidence matrix is a digital representation of an input sequence, entering a regular expression, searching for a symbol sequence of the input sequence that matches the regular expression, wherein a score value is computed by the processor using confidence values of the confidence matrix, wherein the score value is an indication of the quality of the matching between the symbol sequence of the input sequence and the regular expression. Further, the invention relates to a computer program product which when executed by a processor of a computing device performs the method.