Abstract:
Provided are a method and device for residing a short message verification code. This method includes: conducting keyword matching on a short message content using a regular expression; when the short message content contains a keyword, matching a verification code for the short message content using the regular expression, to acquire a matched verification code; and displaying the verification code on a current interface and displaying a pre-set time. This method can automatically extract a verification code in a short message and display a pre-set time on a current interface. Within this pre-set time, a user can fill in a verification code on a verification code interface according to the displayed verification code without the need for the user to remember the verification code and to frequently switch between a short message application and a current application as well.

Description:
[0001]    The present disclosure claims the priority to Chinese Patent Application No. 201410162920.3, titled “METHOD FOR RESIDING VERIFICATION CODE IN SHORT MESSAGE AND DEVICE THEREOF”, filed on Apr. 22, 2014 with the State Intellectual Property Office of People&#39;s Republic of China, which is incorporated herein by reference in entirety. 
       TECHNICAL FIELD 
       [0002]    The present disclosure relates to the field of mobile communication, and in particular to a method for residing a verification code in a short message and a device thereof. 
       BACKGROUND 
       [0003]    At present, a short message application in a mobile device is often used to receive verification messages for consumption, registration, activation or confirmation. In practice, after receiving a notification for a short message, viewing the short message, reading the short message and recognizing the verification code from text of the short message, a user needs to input a verification code at a corresponding location on a verification code interface. Therefore, the entire process is very cumbersome. Especially in a case that the verification code is to be received and inputted by the same one mobile device, switching needs to be performed frequently between an interface of the short message application and an input interface for the verification code. 
         [0004]    In addition, after seeing the verification code on the interface of the short message application, the user needs to memorize the verification code for a period of time to accurately input the verification code on the input interface for the verification code, which is a bad experience for a user with a poor memory. Therefore, it is desired to provide a new method for facilitating inputting of the verification code by the user and improving user experience. 
       SUMMARY 
       [0005]    In view of the above, a method for residing a verification code in a short message and a device thereof are provided according to the present disclosure, for facilitating inputting the verification code by a user and improving user experience. 
         [0006]    In order to achieve the above object, the following technical solutions are provided according to embodiments of the present disclosure. 
         [0007]    A method for residing a verification code in a short message is provided, which includes: 
         [0008]    performing keyword matching on content of the short message based on a regular expression; 
         [0009]    performing verification code matching on the content of the short message based on a regular expression in a case that the content of the short message includes a keyword, where the verification code includes a digit, a letter or a combination thereof; 
         [0010]    obtaining the matched verification code; and 
         [0011]    displaying the verification code on an interface for preset time. 
         [0012]    Preferably, in the performing the keyword matching on the content of the short message based on the regular expression, the keyword may include one or more of verification code, verification word, activation code, activation word, check code, check word, confirmation code, confirmation word, checking code and checking word. 
         [0013]    Preferably, the method may further include: 
         [0014]    obtaining a keyword in a case that the content of the short message includes the keyword; 
         [0015]    combining the keyword and the verification code into a string; and 
         [0016]    displaying the string on an interface for preset time. 
         [0017]    Preferably, the preset time may be 20 s. 
         [0018]    Preferably, the displaying the verification code on the interface for the preset time may include: 
         [0019]    generating a notification based on the verification code and the preset time and sending the notification to a status bar; and 
         [0020]    displaying the notification by the status bar. 
         [0021]    Preferably, the displaying the string on the interface for the preset time may include: 
         [0022]    generating a notification based on the string and the preset time and sending the notification to the status bar; and 
         [0023]    displaying the notification by the status bar. 
         [0024]    Preferably, the status bar may be displayed at the top, the bottom, the far left or the far right of a screen of a mobile device. 
         [0025]    A device for residing a verification code in a short message is provided, which includes: 
         [0026]    a keyword matching unit configured to perform keyword match on content of the short message based on a regular expression; 
         [0027]    a verification code matching unit configured to perform verification code matching on the content of the short message based on a regular expression in a case that the content of the short message includes a keyword, where the verification code includes a digit, a letter or a combination thereof; 
         [0028]    a first obtaining unit configured to obtain the matched verification code; and 
         [0029]    a display unit configured to display the verification code on an interface for preset time. 
         [0030]    Preferably, the device may further include a second obtaining unit configured to obtain a keyword in a case that the content of the short message includes the keyword. 
         [0031]    Preferably, the device may further include a combining unit configured to combine the keyword and the verification code into a string; and the display unit may be further configured to display the string on an interface for preset time. 
         [0032]    Compared with the conventional technology, the present disclosure has the following benefits. 
         [0033]    In the embodiments of the present disclosure, the verification code in the short message can be extracted automatically and displayed on the interface for the preset time. During the preset time, a user can input the verification code on an input interface for the verification code based on the displayed verification code. In this way, the user does not need to memorize the verification code and does not need to switch between a short message application and a current application frequently. In the method, the verification code is displayed on the interface for the verification code directly, thereby greatly facilitating inputting of the verification code by the user and improving user experience. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0034]    In order to illustrate technical solutions in embodiments of the invention or in the conventional technology more clearly, drawings used in the description of the embodiments or the conventional technology are introduced briefly hereinafter. Apparently, the drawings described hereinafter merely illustrate some embodiments of the invention, and other drawings may be obtained by those skilled in the art based on these drawings without any creative efforts. 
           [0035]      FIG. 1  is a flow chart of a method for residing a verification code in a short message according to an embodiment of the present disclosure; 
           [0036]      FIG. 2  is a flow chart of another method for residing a verification code in a short message according to an embodiment of the present disclosure; 
           [0037]      FIG. 3  is a flow chart of still another method for residing a verification code in a short message according to an embodiment of the present disclosure; 
           [0038]      FIG. 4  is a schematic structural diagram a device for residing a verification code in a short message according to an embodiment of the present disclosure; and 
           [0039]      FIG. 5  is a schematic structural diagram of another device for residing a verification code in a short message according to an embodiment of the present disclosure. 
       
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
       [0040]    The technical solutions in embodiments of the present disclosure are clearly and completely described hereinafter in conjunction with the drawings in the embodiments of the present disclosure. Apparently, the described embodiments are only a few rather than all of the embodiments of the present disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without any creative efforts fall within the scope of protection of the present disclosure. 
         [0041]    A method for residing a verification code in a short message is provided according to the present disclosure. As shown in  FIG. 1 , the method includes steps S 101  to S 104 . 
         [0042]    In step S 101 , keyword matching is performed on content of the short message based on a regular expression. 
         [0043]    A regular expression is also referred to as a regular representation. In computer science, a regular expression refers to a single string which is used to describe or match a series of strings meeting a particular syntactic rule. A regular expression is usually used to retrieve and/or replace text content having a particular pattern. 
         [0044]    In the present disclosure, the regular expression is used to detect whether the content of the short message includes a keyword. Specifically, matching is performed on all phrases in the content of the short message with respect to all keywords to determine whether the content of the short message includes the keyword. 
         [0045]    In performing keyword matching, the keyword includes one or more of verification code, verification word, activation code, activation word, check code, check word, confirmation code, confirmation word, checking code and checking word. It is to be understood that, the keyword in the present disclosure may further include other words similar to the verification code. 
         [0046]    Matching is performed on the content of the short message with respect to the above keywords. In a case that the content of the short message includes any one of the above keywords, the content of the short message is determined to include the keyword, and the process goes to step S 102 . In a case that the content of the short message does not include any word related to the keyword, it is determined that the short message includes no verification code, and no process is performed. 
         [0047]    In step S 102 , in a case that the content of the short message includes the keyword, verification code matching is performed on the content of the short message based on a regular expression. The verification code includes a digit, a letter or a combination thereof 
         [0048]    In a case that that the content of the short message includes the keyword, it is determined that the content of the short message may include the verification code, and thus matching is performed on the content of the short message based on the regular expression. 
         [0049]    At present, a verification code usually includes a digit, a letter or a combination thereof, and has a length of 4 to 9 characters. Therefore, in the embodiment, verification code matching is performed with respect to 4 to 9 digits or letters. In a case that the verification code matching of 4 to 9 digits or letters is successful, it is determined that the verification code is included. If the verification code matching of a larger or smaller number of digits or letters is successful, it is determined that no verification code is included, and no processing is performed. It is to be understood that, the number of characters in the verification code is not the emphasis of the present disclosure, and in a case that a verification code with other number of characters is used to implement the present disclosure, it also falls within the scope of protection of the present disclosure. 
         [0050]    At present, content of a short message mainly includes Chinese characters. A string in the content of the short message is extracted based on the regular expression, and it is determined whether the string has a length within a range from 4 to 9 characters. If the length is within the range, the string is determined as the verification code temporarily. If the content of the short message includes multiple strings meeting a requirement on the verification code, verification code extracting is not performed on the short message. If the multiple strings are extracted, it may bring trouble to a user since the user cannot determine which one is the needed verification code. Therefore, in a case that there are multiple strings meeting the requirement on the verification code, verification code extracting is not performed on the content of the short message. In this case, the user may open the short message and input the verification code in a conventional manner. 
         [0051]    In step S 103 , the matched verification code is obtained. 
         [0052]    In step S 104 , the verification code is displayed on an interface for preset time. 
         [0053]    The verification code may be displayed on the interface for the preset time to enable the user to complete the input of the verification code within the preset time. Preferably, the preset time is 20 s. 
         [0054]    Preferably, a notification is generated based on the verification code and the preset time and is sent to a status bar, and the notification is displayed by the status bar. That is, the notification is displayed by the status bar for the preset time. 
         [0055]    Preferably, the status bar may be at the top, the bottom, the far left or the far right of a screen of a mobile device. That is, a location for displaying the verification code may be arbitrary, as long as the user is not prevented from inputting the verification code. 
         [0056]    The method for residing a verification code in a short message is provided according to the present disclosure. In the method, the verification code in the short message can be extracted automatically and displayed on the interface for the preset time. During the preset time, a user can input the verification code on a verification code interface based on the displayed verification code. In this way, the user does not need to memorize the verification code and does not need to switch between a short message application and a current application frequently. In the method, the verification code is displayed on the interface for the verification code directly, and it only takes one step to input the verification code, i.e., manually inputting the verification code, thereby greatly facilitating inputting of the verification code by the user and improving user experience. 
         [0057]    In the present disclosure, the content of the verification code resides on the interface. In an aspect, the content of the verification code is presented for the user considerably, so that the user can read and input the verification code without interrupting a current operation. In another aspect, in the present disclosure, the verification code is not inputted into an input box on the current interface rashly, since in this case, unnecessary trouble would be caused to the user if the current input box is not an input box for the current verification code. The present disclosure can solve the above problems very well and improve user experience. 
         [0058]    On the basis of the above embodiments, another embodiment is further provided in the present disclosure. As shown in  FIG. 2 , the embodiment includes steps S 201  to S 206 . 
         [0059]    In step S 201 , keyword matching is performed on content of a short message based on a regular expression. 
         [0060]    In step S 202 , in a case that the content of the short message includes a keyword, the keyword is obtained. 
         [0061]    In step S 203 , in a case that the content of the short message includes the keyword, verification code matching is performed on the content of the short message based on a regular expression. A verification code includes a digit, a letter or a combination thereof 
         [0062]    In step S 204 , the matched verification code is obtained. 
         [0063]    In step S 205 , the keyword and the verification code are combined into a string. 
         [0064]    In step S 206 , the string is displayed on an interface for preset time. 
         [0065]    Preferably, a notification is generated based on the string and the preset time and is sent to a status bar, and the notification is displayed by the status bar. 
         [0066]    In the embodiment, instead of only the verification code, the string including the keyword and the verification code is displayed on the interface to notify a user that a combination of a digit and/or a letter displayed on the interface, which has a length of 4 to 9 characters, is the verification code, so that user experience is improved. 
         [0067]    A specific embodiment is further provided in the present disclosure. As shown in  FIG. 3 , the specific embodiment includes steps S 301  to S 304 . 
         [0068]    In step S 301 , a user clicks a button of “obtain verification code” on an interface which needs a verification code. 
         [0069]    In step S 302 , a short message including the verification code is received via a mobile device. Content of the short message is that: your verification code is relulo, please do not forward the verification message to other people for the security of your account. 
       [Smartisan Digital] 
       [0070]    In step S 303 , a keyword and the verification code are extracted and combined into a string. 
         [0071]    After performing matching on the content of the short message based on a regular expression, it is obtained that the resultant keyword is “verification code”, content of the verification code is “relulo”, and the combined string is “verification code: relulo”. 
         [0072]    In step S 304 , the string and a time parameter are sent to a status bar for displaying of content of the string by the status bar, and the string is displayed on the status bar for time determined by the time parameter. 
         [0073]    As shown in  FIG. 4 , a device for residing a verification code in a short message is further provided according to the present disclosure, which includes: 
         [0074]    a keyword matching unit  100  configured to perform keyword match on content of the short message based on a regular expression; 
         [0075]    a verification code matching unit  200  configured to perform verification code matching on the content of the short message based on a regular expression in a case that the content of the short message includes a keyword, where the verification code includes a digit, a letter or a combination thereof; 
         [0076]    a first obtaining unit  300  configured to obtain the matched verification code; and 
         [0077]    a display unit  400  configured to display the verification code on an interface for preset time. 
         [0078]    Preferably, as shown in  FIG. 5 , the device further includes: 
         [0079]    a second obtaining unit  500  configured to obtain a keyword in a case that the content of the short message includes the keyword. 
         [0080]    Preferably, as shown in  FIG. 5 , the device further includes: 
         [0081]    a combining unit  600  configured to combine the keyword and the verification code into a string; and 
         [0082]    the display unit  400  is further configured to display the string on an interface for preset time. 
         [0083]    The device for residing a verification code in a short message is provided according to the present disclosure. The device can extract the verification code in the short message automatically and display the verification code on the interface for the preset time. During the preset time, a user can input the verification code on a verification code interface based on the displayed verification code. In this way, the user does not need to memorize the verification code and does not need to switch between a short message application and a current application frequently. The verification code is displayed on the interface for the verification code directly, and it only takes one step to input the verification code, i.e., manually inputting the verification code, thereby greatly facilitating inputting of the verification code by the user and improving user experience. 
         [0084]    If a function described in the method according to the embodiments is implemented in a form of a software functional unit and is sold or used as a separate product, it may be stored in a computer readable storage medium. With this in mind, part of the embodiments of the present disclosure which contributes to the convention technology, or, part of the technical solutions may be implemented in a form of a software product, and the software product is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, a mobile computer device or a network device, etc.) to execute all or some of the steps in the method according to the embodiments of the present disclosure. The storage medium includes a medium capable of storing program codes, such as a USB flash disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk. 
         [0085]    The various embodiments of the present disclosure are described in a progressive way, differences from other embodiments are emphatically illustrated in each of the embodiments, and reference can be made to each other for understanding the same or similar sections. 
         [0086]    The above descriptions of the disclosed embodiments enable those skilled in the art to implement or use the present disclosure. Various changes to the embodiments are apparent to those skilled in the art, and general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments disclosed herein but is to conform to the widest scope consistent with the principles and novel features disclosed herein.