Adaptation of regular expressions under heterogeneous collation rules

Method and apparatus for adapting regular expressions for different contexts. Embodiments include identifying a regular expression in an initial form provided by a user. Embodiments include retrieving, from a repository, an adapted form of the regular expression based on the initial form. Embodiments include transforming the regular expression based on the adapted form to generate an adapted regular expression. Embodiments include evaluating the adapted regular expression to produce an output.

BACKGROUND

The present disclosure relates to regular expressions, and more specifically, to adaptation of regular expressions for different contexts with varying collation rules.

A regular expression (regex) generally refers to a sequence of characters that define a search pattern. This pattern may be used for a variety of purposes, such as by string searching algorithms for “find” or “find and replace” operations on strings, or for input validation. Regular expression set matching may be used to locate all occurrences of substrings of a given input string matching a regular expression. The regular expression may be a string of symbols (for example, characters, letters, and digits) that defines a pattern used in a search for a matching input string. The symbols used by the regular expression and by the input string are drawn from a set of the symbols, known as an alphabet of the regex. A pattern may consist of one or more character literals, operators, or constructs.

Regular expression applicability is very broad. Several programming languages directly provide regular expression support to ease programmer tasks when dealing with text analysis. Regular expressions are also used in search engines, search and replace dialogs of word processors and text editors, in text processing utilities such as a stream editor (sed), and in lexical analysis.

Evaluation of regular expressions often involves the use of collation rules. Collation generally involves a set of rules for comparing characters in a locale. The unit of comparison is called a collation element or collation unit. By definition, a locale is a subset of a user's environment that defines conventions for a specified culture or group. A collation rule is normally governed by a locale-based specification or standard; for instance, Unicode collation algorithm provides a specification for how to compare Unicode elements. A collation algorithm usually consists of at least three-levels: alphabetic, diacritic, and case comparisons to ensure a consistent result. A collation element may be one character, such as a, A, and 2 in English and a, “a” with accent, in French, or a sequence of characters, such as ch in French and OE in German. Collation rules determine the sorting order of collation elements of a locale. Collation rules are locale-specific, and hence the same set of collation elements may be sorted differently in different locales. For example, letters A, B, D, and c may be sorted as “A B D c” in English and “A B c D” in French.

Due to variations in collation rules, regular expressions may be evaluated differently in different contexts, such as different locales, or may not work properly in certain contexts. For example, if the letters A, B, D, and c are sorted as “A B D c” in English and “A B c D” in French, then the regular expression [A-D] may be evaluated as [ABD] in English and as [ABcD] in French. These inconsistent evaluations may cause unintended and unpredictable results when regular expressions are used in applications throughout various contexts.

As such, there is a need in the art for techniques for adapting regular expressions for use in different contexts that may have different collation rules.

SUMMARY

According to one embodiment of the present invention, a method includes: identifying a regular expression in an initial form provided by a user; retrieving, from a repository, an adapted form of the regular expression based on the initial form; transforming the regular expression based on the adapted form to generate an adapted regular expression; and evaluating the adapted regular expression to produce an output.

In certain embodiments, a computing system may be configured to perform methods described herein. In some embodiments, a computer-readable storage medium may store instructions that, when executed by one or more processors, cause the one or more processors to perform methods described herein.

DETAILED DESCRIPTION

Embodiments presented herein involve adapting regular expressions for different contexts. A regular expression (regex) generally refers to a sequence of characters that define a search pattern. The search pattern may be used for a variety of purposes, such as by string searching algorithms for “find” or “find and replace” operations on strings, or for input validation. Evaluation of regular expressions often involves the use of collation rules. Collation rules may vary across different contexts, such as for different locales. For example, collation rules for different locales may specify different orders for sorting certain characters. As such, certain regular expressions may be evaluated differently in different contexts, such as in different locales with varying collation rules.

It may be difficult and time-consuming to modify and debug regular expression patterns for different locales. Furthermore, many automated test tools are not designed to test the same regular expressions in different locales. Therefore, in order to overcome these obstacles, techniques described herein involve dynamically adapting regular expressions for different contexts based on learned adaptations.

In one example, a user of an application in a given context, such as a given locale, defines adapted forms of regular expressions for the given context. For instance, a user of a software development application may provide an application command that includes a regular expression and then may determine that the regular expression does not work properly in the given locale. The application may, for example, notify the user that syntax of the regular expression is not recognized. Alternatively, the application may provide the user with an output that is different than what the user expected based on the regular expression. For example, the given locale may have collation rules that are different from what the user expected, and so the results of evaluating the regular expression may be inaccurate. As such, the user may initiate a process to define an adapted form of the regular expression. In some embodiments, the user is prompted to define the adapted form of the regular expression.

The user may, for instance, specify a more explicit form of the regular expression for the given context. For example, if the regular expression provided by the user is [A-E] (e.g., a regular expression specifying a range indicated by a “-” or dash character) and the collation rules of the given context result in the regular expression being incorrectly evaluated as [AaBbCcDdE], the user may specify that the adapted form of the regular expression [A-E] is [ABCDE]. In some embodiments, the user specifies the adapted form by providing input to a user interface associated with the application. The adapted form of the regular expression may then be stored in a local repository for the user, and may be used to transform the regular expression whenever it used again by the user in the given context. For instance, the next time the user provides an application command including the regular expression [A-E], the adapted form may be retrieved from the local repository and used to automatically transform the regular expression into [ABCDE].

As users in various contexts define adapted forms of regular expressions according to techniques described herein, a centralized system may monitor these adapted forms that are stored in local repositories in order to learn global adaptations that can be shared with other users. For example, statistical analysis may be performed in order to identify trends in adapted forms of regular expressions in various contexts in order to identify adapted forms that can be stored in a global repository and/or provided for use in association with different users. In one example, if it is determined that a threshold percentage or number of users in a given context (e.g., locale) have locally defined a particular adapted form of a given regular expression, then the particular adapted form may be stored in a global repository for use by other users in the given context and/or transmitted to client devices associated with other users in the given context for storage in local repositories. The global repository may store adapted forms of regular expressions in association with initial forms of the regular expressions (e.g., the forms in which the regular expressions were initially provided by users) and also in association with context information (e.g., identifiers of the locales in which the initial forms and/or adapted forms were defined, application attributes, user attributes, and the like). In some embodiments, certain adapted forms of regular expressions stored in the global repository may be provided to users automatically, such as to users in contexts matching those associated with the adapted forms in the global repository.

Accordingly, techniques described herein allow for both user-guided and automated learning techniques for adapting regular expressions for different contexts. User-guided learning at a local level may be automatically analyzed and used to guide automated learning processes at a global level so that users may be automatically provided with adapted forms of regular expressions based on context. It is noted that, as used herein, “local” generally refers to something that takes place or is stored on the level of an individual user or client device, while “global” generally refers to something that takes place or is stored at a centralized level that is common to a plurality of users and/or client devices.

FIG.1illustrates an example networked computing environment in which regular expressions may be adapted for different contexts, according to embodiments of the present disclosure. As illustrated, computing environment100includes client devices120,130, and140and server150, connected via network110. Network110may generally represent a connection over which data may be transmitted. For example, network110may be a local area network, wide area network, cellular network, ad-hoc network, near-field communication network, the Internet, or any other known or later developed network.

Client devices120,130, and140are generally representative of computing devices through which a user can interact with applications, such as application122, provide application commands including regular expressions, define adapted forms of regular expressions as described herein, and the like. Client devices120,130, and140may each be, for example, a laptop computer, a desktop computer, a thin client, a tablet computer, a mobile computing device, or the like. Client device120is included to be representative of each of client devices120,130, and140, and components depicted and described with respect to client device120may also be included in client devices130and140. Furthermore, client devices120,130, and140may generally be representative of a plurality of client devices, and a larger or smaller number of client devices may be present in computing environment100.

Client device120includes an application122, which may be representative of an application to which a user provides application commands including regular expressions. For example, application122may comprise a software development application, a command line interface, a web browser, a search engine or information retrieval application, a word processor, a text editor, and/or another type of application in which regular expressions may be used. In some embodiments, application122comprises a user interface through which the user provides input to and receive output from application122.

Client device120further includes a local cognitive regular expression (regex) adaptation (CRA) engine124, which generally performs operations related to adapting regular expressions for different contexts at a local or user level. It is noted that operations described as being performed by local CRA engine124may alternatively be performed using different combinations of local and/or remote components.

Local CRA engine124may receive application commands provided by a user, such as from application122, and identify regular expressions present in the application commands. In some embodiments, local CRA engine124attempts to evaluate regular expressions and, if successful, outputs results of evaluating the regular expressions, such as to application122. If unable to successfully evaluate a given regular expression, local CRA engine124may output an indication that the given regular expression could not be evaluated, such as including a description of why the given regular expression could not be evaluated (e.g., “syntax unknown”).

Local CRA engine124may access local CRA repository126in order to determine whether an adapted form of a given regular expression is stored. For example, local CRA repository126may generally represent a data storage entity or file that stores mappings between initial forms of regular expressions and adapted forms of regular expressions for a given user in a given context. An initial form of a regular expression may, for instance, be a form in which a given user initially provided the regular expression, while an adapted form of the regular expression may be a more precise or explicit form that the user specifies for the regular expression through a learning process.

In one embodiment, local CRA engine124receives a regular expression in an initial form that was provided by a user of application122and determines whether the initial form is mapped to an adapted form for the regular expression in local CRA repository126, such as for a particular locale in which the user provided the regular expression. If an adapted form for the regular expression is found in local CRA repository126for the particular locale, then local CRA engine124may transform the regular expression from the initial form into the adapted form. Local CRA engine124may then evaluate the regular expression in the adapted form and provide the result of evaluating the regular expression to the user, such as through application122. In one example, the regular expression is provided by the user in the context of an application command, such as a search command or a translate command to application122, and the regular expression is evaluated as part of evaluating the application command. Furthermore, while local CRA engine124may evaluate regular expressions and/or application commands in some cases, there may be other embodiments where local CRA engine124adapts regular expressions and then passes the adapted regular expressions to one or more different components for evaluation.

Local CRA engine124may allow users to define adapted forms of regular expressions. For example, a user may provide input, such as via application122, defining an adapted form for a given regular expression. In one example, the user specifies that an adapted form for the regular expression “tr [1-7] []” (e.g., which is a regular expression for translating the numbers 1-7 into the Japanese symbols for each day of the week) is “tr [1234567] []”. The user may provide the adapted form through input comprising a particular command, such as a “machine learning” (ml) command supported by local CRA engine124. For example, the user may define the adapted form by providing the command “tr [1-7] []-ml [1234567] []” to application122. As such, local CRA engine124may store a mapping between the initial form “tr [1-7] []” and the adapted form “tr [1234567] []” in local CRA repository126. In some embodiments, local CRA engine124also stores context information along with the mapping, such as an identifier of a locale for which the user defined the adapted form. For example, context information may include the locale identifier “JA_JP.UTF-8”, which signifies that the language is Japanese, the country is Japan, and that UTF-8 or Unicode (Universal Coded Character Set) Transformation Format 8-bit encoding is used. The context information may be determined based on attributes of the user, the application, and/or the application command.

Subsequently, if the user provides the regular expression “tr [1-7] []” in the given context, then local CRA engine124will locate the adapted form “tr [1234567] []” based on the mapping stored in local CRA repository126and use the adapted form to transform the regular expression. Thus, regardless of collation rules for the given context, the regular expression will be evaluated in the way in which it is expected by the user to be evaluated.

Server150is generally representative of a computing device, such as a server computer or desktop computer, that performs operations related to adapting regular expressions for different contexts for a plurality of users. Server150includes global CRA engine152, which generally performs operations related to tracking and analyzing local adaptations of regular expressions in order to determine globally applicable adaptations. For example, global CRA engine152may track operation of regular expressions at client devices120,130, and140, such as by receiving information related to regular expressions from local CRA engine124and/or local CRA repository126(and corresponding local components of client devices130and140).

In some embodiments, global CRA engine152regularly receives adapted forms of regular expressions and associated information (e.g., initial forms of the regular expressions and context information) from client devices120,130, and140and identifies trends. In one embodiment, global CRA engine152performs statistical analysis to identify adapted forms of regular expressions that have been frequently defined by users in certain contexts. For example, global CRA engine152may determine whether a threshold percentage or number of users in a given context have defined a given adapted form of a regular expression and, if so, may store the given adapted form and associated information in global CRA repository154.

Global CRA repository154generally represents a data storage entity or file that, like local CRA repository126, stores mappings between initial forms of regular expressions and adapted forms of the regular expressions. In some embodiments, the mappings also include context information. Adapted forms of regular expressions stored in global CRA repository154may be provided to various users, such as users of client devices120,130, and140, based on context information. For example, if a user of client device140is associated with a given locale, then global CRA engine152may provide one or more adapted forms of regular expressions that are mapped to the given locale in global CRA repository154to client device140. Client device140may store the adapted form along with its corresponding initial form and, in some embodiments, context information, in a local CRA repository for use in adapting regular expressions. It is noted that in some embodiments, rather than storing “global” adapted forms of regular expressions in global CRA repository154, global CRA engine152may alternatively distribute a given adapted form to applicable client devices upon determining that it is relevant, such as based on statistical analysis or another technique. As such, global CRA engine152is able to learn adapted forms of regular expressions that are defined by individual users locally on client devices but that are also more broadly applicable to other users.

While client devices120,130, and140and server150are illustrated as separate components inFIG.1, it should be recognized that functionality described with respect to client devices120,130, and140and server150may be implemented on any number of computing systems, either as one or more standalone systems or in a distributed environment.

FIG.2illustrates an example200of components related to adapting regular expressions for different contexts, according to embodiments of the present disclosure. Example200includes local CRA engine124and global CRA engine152ofFIG.1.

Local CRA engine124includes configuring module202, which generally performs operations related to configuration of local CRA engine124. For example, configuring module202may allow a user to specify one or more configuration parameters related to operation of local CRA engine124, and the configuration parameters may be stored in a configuration file. Configuration parameters may include, for example, attributes of local CRA repository126ofFIG.1, such as a file name and storage location, user preferences (e.g., locales and applications relevant to the user), synchronization preferences (e.g., whether and how often the user wishes to receive adapted forms of regular expressions from and/or share locally adapted forms of regular expressions with global CRA engine152), and the like.

Local CRA engine124further includes training module204, which generally performs operations related to learning adapted forms of regular expressions. For example, training module204may prompt the user of client device120ofFIG.1, such as via application122ofFIG.1, to define an adapted form of a regular expression, such as after detecting an error when evaluating an initial form of the regular expression. In other embodiments, the user may initiate the process without being prompted. Training module204may receive definitions of adapted forms of regular expressions from the user, and may store the adapted forms along with initial forms and context information (e.g., locale identifiers of adapted forms and/or initial forms, an application identifier of application122ofFIG.1, a user identifier of the user, and/or the like) as mapping information in local CRA repository126ofFIG.1. Training module204may further perform operations related to synchronizing local CRA repository126ofFIG.1with other repositories, such as global CRA repository154and/or other local CRA repositories. For example, training module204may transmit all mapping information stored in local CRA repository126ofFIG.1to global CRA engine152ofFIG.1for analysis. Global CRA engine152ofFIG.1may then determine, based on an analysis of the mapping information in conjunction with mapping information received from a plurality of users, whether to store the mapping information in global CRA repository154ofFIG.1and/or to distribute the mapping information to given client devices associated with given users. For example, global CRA engine152may perform statistical analysis on mapping information received from a plurality of users by determining how many times a given adapted form of a regular expression appears in the mapping information in association with a given context (e.g., locale identifier) and a given initial form of the regular expression. As such, global CRA engine152may determine whether the given adapted form is used commonly enough in the context to consider the given adapted form for global use, such as for other users associated with the context. If, for example, a threshold number or percentage of users have defined the given adapted form in the context, then global CRA engine152may store the given adapted form (along with the information it is mapped to) in global CRA repository154ofFIG.1and/or send the given adapted form (along with the information it is mapped to) as mapping information to client devices associated with the context. Training module204may, for example, receive the mapping information from global CRA engine152ofFIG.1and store the mapping information in local CRA repository126ofFIG.1.

Local CRA engine124further includes adapting module206, which generally performs operations related to adapting regular expressions for different contexts, such as by determining whether an adapted form of a given regular expression is mapped in a repository to a received initial form of the given regular expression and/or information related to a given context in which the given regular expression is received. For example, adapting module206may identify a given regular expression in an initial form, such as in a user-provided application command received from application122ofFIG.1, and determine (e.g., based on mapping information stored in a repository as described herein) whether an adapted form of the regular expression is applicable. For example, adapting module206may determine context information related to the regular expression, such as a locale, an identifier of application122ofFIG.1to which the user provided the application command, an identifier of the user, and/or the like. Adapting module206may then determine whether there is an adapted form of the regular expression mapped to the initial form and/or the context information in local CRA repository126ofFIG.1. In certain embodiments, adapting module206may also access global CRA repository154ofFIG.1in order to determine whether there is an adapted form of the regular expression mapped to the initial form and/or the context information in global CRA repository154ofFIG.1. In other embodiments, any “global” adapted forms applicable to local CRA engine124have already been provided by global CRA engine152ofFIG.1to local CRA engine124and stored in local CRA data store126. Upon determining that an adapted form of the regular expression is applicable for the context, adapting module206may transform the regular expression based on the adapted form. For example, the initial form may be replaced with the adapted form of the regular expression.

Local CRA engine124further includes regex engine208, which generally performs operations related to evaluating regular expressions. For example, regex engine208may receive a regular expression, which may have been transformed by adapting module206based on an adapted form, and evaluate the regular expression to determine a result. For example, regex engine208may apply any collation rules applicable under the context and/or apply an adapted form in order to determine an output, such as a sequence of characters identified by the regular expression. In certain embodiments, regex engine208may evaluate a regular expression as part of evaluating a larger application command, such as a search command, and then may return a result of evaluating the regular expression and/or the application command to application122ofFIG.1. In some embodiments, regular expressions and/or application commands are evaluated separately from local CRA engine124, such as by a different component of client device120ofFIG.1.

Global CRA engine152includes a tracking module210, which generally performs operations related to tracking locally defined adapted forms of regular expressions and identifying adapted forms that may have broader applicability. Tracking module210may receive mapping information (e.g., including initial forms and adapted forms of regular expressions along with context information) from client devices, such as from local CRA engine124of client device120ofFIG.1and from corresponding local CRA engines of other client devices, such as at regular intervals or whenever new adapted forms of regular expressions are locally defined and stored in local CRA repositories. Tracking module210may also track other information related to regular expressions on various client devices, such as returned mismatch errors. For example, tracking module210may receive logs of operations related to regular expression from client devices.

Global CRA engine152further includes a global training module212, which generally performs operations related to learning adapted forms of regular expressions with broader applicability based on locally defined adapted forms. For example, global training module212may analyze the mapping information and/or other information (e.g., logs) received by tracking module210to identify trends. A trend may be identified, for instance, when a given adapted form appears a certain number of times in association with a given context in the mapping information. For example, if a certain number of users in a particular locale have locally defined the same adapted form of a given regular expression, global training module212may identify the adapted form as a globally applicable adapted form of the regular expression for the particular locale and/or for other similar locales (e.g., locales with a common country, language, encoding scheme, and/or the like). Global training module212may store mapping information that maps the adapted form to an initial form and context information in global CRA repository154ofFIG.1and/or may transmit the mapping information to one or more other client devices to which the mapping information is considered applicable (e.g., based on context information associated with the client devices).

FIG.3illustrates an example of adapting regular expressions for different contexts, according to embodiments of the present disclosure.FIG.3includes a user interface300, which may be associated with application122ofFIG.1, and which may allow a user to provide input and receive output related to application122and/or local CRA engine124ofFIG.1. For example, user interface300may provide a command line interface through the user provides application commands (e.g., in an interpreted programming language) and through which the user is provided with output based on the application commands.

First, the user provides application command302, “echo 1234 tr [0-9] []”. Application command302is an echo command (e.g., a command to display a standard output of an input string) in which the output string is to be translated based on a translate command (e.g., a tr command) wherein the numbers 0-9 are to be translated to the Chinese numbers..

Output304is provided to the user in response to application command302, reading “Syntax unknown, please use -ml to launch machine learning” and providing an example usage of the -ml command, “Usage: tr [param1] [param2]-ml [specific param1] [specific param2]”. Output304generally indicates that there was unknown syntax used in application command302, such as because the syntax of “[0-9] []” does not work properly or is not known in the locale in which the regular expression was provided.

In response to output304, the user provides application command306, “tr [0-9] []-ml [0123456789] []”. Application command306is a -ml command, as suggested in output304, and defines an adapted form ([0123456789] []) of the initial form ([0-9] []) of the regular expression for the context. In other words, [0-9] should be adapted to [0123456789] and [] should be adapted to [] in the context. For example, local CRA engine124ofFIG.1may determine a context in which application command306was received and store a mapping between the context information (e.g., locale identifier, application parameters, user identifier, and/or the like), the initial form ([0-9] []), and the adapted form ([0123456789] []) in local CRA repository126ofFIG.1.

In response to application command306, the user is provided with output308, “Machine Learning complete, please re-run the command”. Output308indicates that the -ml command was successful, and that the original application command302may now be re-entered by the user.

The user provides application command310, which is the same as the original application command302, “echo 1234 tr [0-9] []”. This time, the syntax is recognized, since there is an adapted form of the regular expression available. For example, local CRA engine124may determine a context of application command310(e.g., the Chinese locale ZH_Conn.UTF-8), and may determine that an adapted form ([0123456789] []) is mapped to the initial form ([0-9] []) of the regular expression and to the context in local CRA repository126ofFIG.1. As such, local CRA engine124may transform the regular expression based on the adapted form and evaluate application command310accordingly.

In response to application command310, the user is provided with output312, “”. Application command310comprises an echo command to display the string 1234 in which the output string is to be translated based on a translate command wherein the numbers 0-9 are to be translated to the Chinese numbers. As such, output312includes the numbers 1234 translated into their Chinese counterpartsbased on the adapted form of the regular expression.

The user then provides application command314, “echo 545467|tr [0-9] []”. For example, local CRA engine124may determine a context of application command314(e.g., the Chinese locale ZH_Conn.UTF-8), and may again determine that an adapted form ([0123456789] []) is mapped to the initial form ([0-9] []) of the regular expression and to the context in local CRA repository126ofFIG.1. As such, local CRA engine124may transform the regular expression based on the adapted form and evaluate application command314accordingly.

In response to application command314, the user is provided with output316, “”. Application command314comprises an echo command to display the string 545467 in which the output string is to be translated based on a translate command wherein the numbers 0-9 are to be translated to the Chinese numbers. As such, output316includes the numbers 545467 translated into their Chinese counterpartsbased on the adapted form of the regular expression.

FIG.4illustrates example operations400for adapting regular expressions for different contexts, according to embodiments of the present disclosure. For example, operations400may be performed by local CRA engine124ofFIG.1.

At step410, a regular expression is received in an initial form provided by a user. For example, the user may have provided an application command that includes the regular expression to an application, such as application122ofFIG.1, and the application may have provided the application command (or the regular expression) to local CRA engine124ofFIG.1. In one example, the regular expression is provided in an initial form that indicates a range, such as “[A-E]”.

At step420, an adapted form of the regular expression is retrieved from a repository based on the initial form. For example, local CRA engine124ofFIG.1may access local CRA repository126ofFIG.1to identify that the initial form is mapped to the adapted form of the regular expression in mapping information stored in local CRA repository126. In some embodiments, local CRA engine124ofFIG.1also determines a context related to the regular expression, such as by determining a locale in which the regular expression and/or application command was received, one or more attributes related to the application, the application command, and/or the user, such as an application identifier and/or a user identifier, and/or the like. In certain embodiments, local CRA engine124ofFIG.1also uses the context in retrieving the adapted form from the repository, such as by determining that the adapted form is mapped to a combination of the initial form and the context in local CRA repository126ofFIG.1. In one example, the adapted form is “[ABCDE]” and the initial form is “[A-E]”.

It is noted that the repository may include mappings between initial forms of regular expressions (and, in some cases, context information) and adapted forms of the regular expressions. In some embodiments, the repository is a local repository such as local CRA repository126ofFIG.1while in other embodiments the repository is a global repository, such as global CRA repository154ofFIG.1. In some embodiments, the mappings in the repository have been learned based on input from the user and/or based on input from a plurality of users. For example, the repository may include adapted forms of regular expressions provided by the user through a user-guided learning process as described herein. In some examples, the repository includes adapted forms of regular expressions defined by other users. For instance, statistical analysis may have been performed to identify trends across different users' defined adapted forms of regular expressions, such as to determine whether a threshold percentage or number of users in a given context have defined a given adapted form of a regular expression. For example, global CRA engine152ofFIG.1may perform this analysis and identify locally defined adapted forms or regular expressions that may be stored in global CRA repository154and/or provided to other local CRA repositories, such as local CRA repository126, such as based on context. In some embodiments, the repository is synchronized with one or more additional repositories, such as global CRA repository154ofFIG.1and/or other local repositories associated with other users and/or client devices.

At step430, the regular expression is transformed based on the adapted form in order to generate an adapted regular expression. For example, local CRA engine124ofFIG.1may transform the initial form into the adapted form of the regular expression. In one example, “[A-E]” is transformed into “[ABCDE]” based on the adapted form retrieved from the repository.

At step440, the adapted regular expression is evaluated to produce an output. For example, local CRA engine124ofFIG.1may evaluate the adapted regular expression in order to determine a sequence of character literals, numbers, operators, and/or constructs indicated by the adapted regular expression. In one example, “[ABCDE]” is evaluated to produce the sequence of A, B, C, D, and E. In some embodiments the regular expression is evaluated as part of evaluating a larger application command. For example, an application command may involve displaying a certain subset of characters that have been translated from one set into another set, and the regular expression may be used to define one or more of the sets. In some embodiments, the regular expression and/or the application command are evaluated by a separate component from local CRA engine124ofFIG.1. In certain embodiments, the output is provided to the user, such as via a user interface associated with application122ofFIG.1. In other embodiments, the output is used to perform further processing, such as if the regular expression was included in source code for a computer program.

FIG.5depicts a computing system500with which embodiments of the present disclosure may be implemented. For example, computing system500may represent client device120ofFIG.1.

System500includes a central processing unit (CPU)502, one or more I/O device interfaces504(that may provide connections for various I/O devices514, such as keyboards, displays, mouse devices, and the like) to the system500, network interface506(e.g., a physical network interface card), memory508, storage510, and an interconnect512. It is noted that one or more components of system500may alternatively be located remotely and accessed via a network, such as network110. It is further contemplated that one or more components of system500may comprise physical or virtualized components.

CPU502may receive and execute instructions stored in memory508. Similarly, the CPU502may receive and store data related to applications in memory508. The interconnect512transmits programming instructions and application data, among the CPU502, I/O device interface504, network interface506, memory508, and storage510. CPU502is included to be representative of a single CPU, multiple CPUs, a single CPU having multiple processing cores, and other arrangements.

Additionally, the memory508may represent a random access memory. Memory508comprises application520and local CRA engine530, which generally represent application122and local CRA engine124ofFIG.1.

Storage510may be a disk drive, solid state drive, or a collection of storage devices distributed across multiple storage systems. Although shown as a single unit, the storage510may be a combination of fixed and/or removable storage devices, such as fixed disc drives, removable memory cards or optical storage, network attached storage (NAS), or a storage area-network (SAN).

Storage510comprises local CRA repository540, which is generally representative of local CRA repository154ofFIG.1. Local CRA repository540includes mapping information542and logs544. For instance, mapping information542may include mappings between initial forms of regular expressions (and, in some cases context information) and adapted forms of the regular expressions, which may have been generated by local CRA engine530based on input provided by a user of system500and/or based on input from additional users as described herein. For example, one or more mappings in mapping information542may have been received from a global CRA repository, such as global CRA repository154ofFIG.1, such as if the one or more mappings have been defined by a threshold percentage or number of users in a context associated with the user of system500. Logs544may comprise logged operations of local CRA engine530and/or application520, such as related to evaluation and adaptation of regular expressions. In some instances, logs544are used to identify mismatch errors related to evaluation of regular expressions so that the user of system500can be prompted to initiate a learning command to provide adapted forms of the regular expressions. In some embodiments, logs544and/or mapping information542are provided, such as by local CRA engine530, to a centralized location, such as global CRA engine152ofFIG.1, for analysis.

Typically, cloud computing resources are provided to a user on a pay-per-use basis, where users are charged only for the computing resources actually used (e.g. an amount of storage space consumed by a user or a number of virtualized systems instantiated by the user). A user can access any of the resources that reside in the cloud at any time, and from anywhere across the Internet. In context of the present invention, a user may access applications (e.g., application122ofFIG.1) or related data available in the cloud. Doing so allows a user to access this information from any computing system attached to a network connected to the cloud (e.g., the Internet).