Information processing device and information processing method

The information processing device corrects regular expressions and patterns to align with user intentions, addressing the inaccuracies in conventional string manipulation, thereby reducing bugs and security risks.

WO2026083563A1PCT designated stage Publication Date: 2026-04-23NT T INC
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
NT T INC
Filing Date
2024-10-17
Publication Date
2026-04-23

AI Technical Summary

Technical Problem

Conventional string manipulation using regular expressions often fails to accurately represent the intended pattern, leading to bugs and vulnerabilities due to difficulties in writing correct regular expressions, especially in functions like replace and replaceAll, which do not ensure the desired string conversion.

Method used

An information processing device that modifies regular expressions and pattern information based on user-provided examples and mapping information to ensure accurate string manipulation, using a modification unit that corrects the regular expression and replacement pattern to align with user intentions.

Benefits of technology

Enables string manipulation to be performed as intended by the user, reducing bugs and security risks in web applications and other systems that rely on string manipulation functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2024037068_23042026_PF_FP_ABST
    Figure JP2024037068_23042026_PF_FP_ABST
Patent Text Reader

Abstract

An information processing device according to an embodiment receives inputs of a regular expression input to a function for operating a character string, pattern information for identifying an operation of a function for a character string matching the regular expression, a combination of a first character string and a second character string, and association information for associating a portion of the first character string with a portion of the second character string. The information processing device corrects the regular expression and the pattern information on the basis of the association information so that the second character string is obtained as a result of the function performing an operation on the first character string.
Need to check novelty before this filing date? Find Prior Art

Description

Information processing apparatus and information processing method

[0001] The present invention relates to an information processing device and an information processing method.

[0002] Regular expressions are widely used as a way to represent string patterns. However, despite their convenience, regular expressions are often known to be difficult to write in a way that accurately represents the intended pattern. If a regular expression that does not represent the intended pattern is incorporated into a program, it can lead to bugs and vulnerabilities. Therefore, research into how to obtain regular expressions that accurately represent the intended pattern is actively being conducted.

[0003] For example, techniques for correcting regular expressions using examples and techniques for generating regular expressions from natural language are known (see, for example, Non-Patent Documents 1 and 2).

[0004] Nariyoshi Chida and Tachio Terauchi. Repairing DoS Vulnerability of Real-World Regexes. In Proceedings of the 43rd IEEE Symposium on Security and Privacy (S&P 2022), IEEE Computer Society, pp.2060-2077, May, 2022. Nariyoshi Chida and Tachio Terauchi. Repairing Regular Expressions for Extraction. In Proceedings of the 44th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2023), PACMPL 7(PLDI): pp.1633-1656, ACM, June, 2023.

[0005] However, with conventional technologies, string manipulation may not be performed as intended by the user.

[0006] Conventional techniques focus on exact string matching using regular expressions. On the other hand, many string manipulation functions focus on substring matching. For example, the regular expression "[az]+[.]txt" does not match the entire string "test test.txt test", but it matches the part "test.txt".

[0007] Furthermore, among string manipulation functions, replace and replaceAll, which are used for string conversion, are particularly frequently used. For example, since replace and replaceAll take replacement patterns as parameters in addition to regular expressions, simply modifying the regular expression may not produce the result the user intended.

[0008] To solve the above-mentioned problems and achieve the objective, the information processing device is characterized by having an input unit that receives input of a regular expression to be input to a function that manipulates strings, pattern information that specifies the operation of the function on the string that matches the regular expression, a combination of a first string and a second string, and correspondence information that associates a part of the first string with a part of the second string, and a modification unit that modifies the regular expression and the pattern information based on the correspondence information so that the second string is obtained as a result of the function performing an operation on the first string.

[0009] According to the present invention, string manipulation can be performed according to the user's intentions.

[0010] Figure 1 is a diagram showing an example configuration of an information processing device according to the first embodiment. Figure 2 is a diagram showing an overview of the modification process. Figure 3 is a diagram illustrating an example. Figure 4 is a diagram illustrating the location. Figure 5 is a diagram showing a set of examples. Figure 6 is a diagram illustrating the enumeration of templates. Figure 7 is a diagram illustrating the enumeration of templates. Figure 8 is a diagram showing a set of examples. Figure 9 is a diagram illustrating the entry of substrings. Figure 10 is a flowchart showing the flow of the modification process. Figure 11 is a diagram showing an example of a computer that executes a program.

[0011] Embodiments of the information processing apparatus and information processing method according to the present application will be described in detail below with reference to the drawings. However, the present invention is not limited to the embodiments described below.

[0012] [First Embodiment] First, let's explain the string manipulation functions. For example, string manipulation functions include the split function for splitting a string, the trim function for removing leading and trailing whitespace from a string, and the replace and replaceAll functions for converting strings.

[0013] The `replace` and `replaceAll` functions accept a string, a regular expression, and a replacement pattern as arguments. They then replace the substrings in the input string that match the regular expression with the strings represented by the replacement pattern and output the resulting string.

[0014] For example, if you want to replace "#x#" with "x:x", the replaceAll function would be written as (1). "a#b#c".replaceAll(#(1.* ? )#,$1:$1) (1)

[0015] In this case, the output of the replaceAll function is "ab:bc". "a#b#c" is the string to be operated on. "#(1.* ? )# is a regular expression. "$1:$1" is a substitution pattern.

[0016] One objective of the first embodiment is to ensure that string manipulation is performed as intended by the user by modifying the replacement pattern along with the regular expression input to the string manipulation function.

[0017] The configuration of the information processing device of the first embodiment will be explained using Figure 1. Figure 1 is a diagram showing an example of the configuration of the information processing device of the first embodiment. Figure 2 shows an overview of the correction process performed by the information processing device. Figure 2 is a diagram showing an overview of the correction process.

[0018] As shown in FIG. 2, the information processing apparatus 10 receives an example input together with the regular expression before correction and the replacement pattern input to the string operation function. The information processing apparatus 10 corrects the input regular expression and replacement pattern. Further, the information processing apparatus 10 may output the corrected regular expression and replacement pattern, or may output the result of executing the string operation function using the corrected regular expression.

[0019] For example, suppose the user wants to replace all of "**…**" with " <strong>…< / strong> " and writes a replaceAll function with the regular expression on the input side and the replacement pattern in FIG. 2 as arguments.

[0020] On the other hand, in order to actually perform the replacement as the user intends, a replaceAll function with the regular expression on the output side and the replacement pattern in FIG. 2 as arguments is required. The information processing apparatus 10 corrects the regular expression and replacement pattern on the input side to the regular expression and replacement pattern on the output side. The information processing apparatus 10 realizes such correction processing by referring to the example input together with the regular expression and replacement pattern.

[0021] Here, returning to FIG. 1, the information processing apparatus 10 includes an input / output unit 11, a storage unit 12, and a control unit 13.

[0022] The input / output unit 11 is an interface that controls input / output of various data. The input / output unit 11 receives inputs such as, for example, arguments of a string operation function, source code of a program including the string operation function, and a string to be the target of the string operation function.

[0023] The storage unit 12 stores data, programs, etc. that are referred to when the control unit 13 executes various processes. The storage unit 12 is realized by a semiconductor memory element such as a RAM (Random Access Memory), a flash memory (Flash Memory), or a storage device such as a hard disk or an optical disk.

[0024] The storage unit 12 stores template information 121. The template information 121 includes templates used for correction processing. The templates will be described in detail later.

[0025] The control unit 13 controls the entire information processing apparatus 10. The functions of the control unit 13 are realized, for example, by a CPU (Central Processing Unit) executing a program stored in the storage unit 12. The control unit 13 includes a modification unit 131 and an execution unit 132.

[0026] The modification unit 131 modifies a regular expression and a replacement pattern input to a string operation function. The execution unit 132 executes the string operation function using the modified regular expression and replacement pattern. The modification unit 131 includes a construction unit 1311, a determination unit 1312, and an addition unit 1313.

[0027] First, an example will be described in order to explain the details of the modification process by the modification unit 131. The example is information representing the input and output of a string operation function intended by the user.

[0028] For example, in the prior art, when modifying the regular expression of the replaceAll function, an example such as "**a** and **bc** → <strong>a< / strong> and <strong>bc < / strong> " is input. This means that the user wants "**a** and **bc**" to be replaced with " <strong>a< / strong> and <strong> bc < / strong> " by the replaceAll function.

[0029] On the other hand, the example in the prior art can represent the input and output, but does not have information on which substring of the input the output substring is obtained from. Therefore, in this embodiment, the example is given information on which substring of the input the output substring is obtained from.

[0030] Fig. 3 shows an example of this embodiment. Fig. 3 is a diagram for explaining the example. As shown in Fig. 3, the example includes a special left parenthesis with a subscript (Unicode: U+2987) and a special right parenthesis with a subscript (Unicode: U+2988).

[0031] The example in Fig. 3 shows that the user wants the "**a**" enclosed by the special parentheses with subscript 1 to be replaced with "<strong>a< / strong> This means that the user wants it to be replaced with ". Also, from Figure 3, the user wants "**bc**" enclosed in special parentheses with the subscript 2 to be replaced with " <strong> bc < / strong> It can be inferred that they want it to be replaced with "[...]".

[0032] Thus, the information processing device 10 receives input including a regular expression to be input to a function that manipulates strings, pattern information that specifies the operation of the function on the string that matches the regular expression, a combination of a first string and a second string, and mapping information that associates a part of the first string with a part of the second string. The combination of the first string and the second string is an example. The mapping information is, for example, special parentheses with subscripts.

[0033] The information processing device 10 modifies the regular expression and pattern information based on the mapping information so that the second string is obtained as a result of the function performing an operation on the first string.

[0034] Here, the example is given as a triple (w, η, θ). w is the input string. η is a list of ranges of substrings to be replaced. θ is a list of output (replacement) strings. In the example in Figure 3, w = **a** and **bc**. Also, η specifies the subscript and position of special parentheses.

[0035] First, the position of the input string is defined by a number, as shown in Figure 4. Figure 4 is a diagram illustrating the positions. Each character, including spaces, corresponds to one number. For example, numbers 5, 9, and 16 in Figure 4 are half-width spaces. In this case, η = [(0,5),(10,16)].

[0036] In general, the i-th element of η is a combination of the index of the letter w immediately following a special left parenthesis with the subscript i, and the index of the letter w immediately following a special right parenthesis with the subscript 2.

[0037] For example, the first element of η = [(0,5),(10,16)] shows that the character at index 0 (the 0th character "*" of w) is immediately after a special left parenthesis with the index 1, and the character at index 5 (the 5th character "*" of w) is immediately before a special right parenthesis with the index 1.

[0038] Also, θ = [ <strong>a< / strong> , <strong> bc < / strong> ]. In general, the i-th element of θ is the replacement for the input string enclosed in special brackets with the subscript i. That is, the triple (w, η, θ) shown here is such that "**a**" is " <strong>a< / strong> Replaced with " and "**bc**" <strong> bc < / strong> This means that users want it to be replaced with ".

[0039] The information processing device 10 receives input including a regular expression to be input to a function that replaces strings (for example, the replaceAll function), pattern information that identifies the replacement string for the string that matches the regular expression, and mapping information. The information processing device 10 modifies the regular expression and pattern information using the function so that the part of the first string is replaced at the position of the second string that is mapped by the mapping information.

[0040] In the replaceALL function, the regular expression is denoted as reg and the replacement pattern as req. For reg and req to satisfy the example, the following conditions 1 and 2 must be met. Note that reg = [*][*].+[*][*]. Also, req = <strong> text < / strong> Therefore, (w, η, θ) = (**a** and **bc**, [(0,5),(10,16)],[ <strong>a< / strong> , <strong> bc < / strong> ])

[0041] Condition 1: When matching with reg at the position of the special left parenthesis with the subscript i, the match extends to the position of the special right parenthesis with the subscript i, and the string obtained from req becomes θ[i].

[0042] For example, if we perform a matching of reg at position 0 of w, then "**a**" will be matched up to position 5 of w, and from req θ[1], that is, <strong>a< / strong> " is obtained. Also, for example, if we perform a matching of reg at position 10 of w, "**bc**" will be matched up to position 16 of w, and θ[2] from req, that is, " <strong> bc< / strong> " can be obtained.

[0043] Condition 2: Matching `reg` in positions not enclosed in special brackets will fail.

[0044] For example, at positions 6 through 9, which are not enclosed in special parentheses, there are no strings that match `reg`, and the matching fails.

[0045] The correction unit 131 performs a correction process if the regular expression and replacement pattern do not satisfy the example, and outputs a regular expression and replacement pattern that satisfy the example.

[0046] The algorithm for the correction process is explained below. The user wants the string manipulation function to rewrite "[x]y[x]" in the string to "x:y", and leave strings that start with "#" (for example, "#[x]y[x]") unchanged. The replaceAll function provided by the user with this intention is shown in (2). However, "\" is synonymous with a backslash. replaceAll((? <!#)\[(1.*)1\].*\[\1\],$1:$2) (2)

[0047] Figure 5 shows a set of examples entered by the user.

[0048] The modification unit 131 modifies the regular expression and substitution pattern via a template and searches for combinations of regular expression and substitution pattern that match all examples. The template is a regular expression or substitution pattern with a hole added. The hole is represented by □.

[0049] For example, the template is "t::=[C]|tt|t|t|t*| … |□". In the correction process, the part being corrected in the regular expression or substitution pattern is represented by a hole. For example, "□*@□*..*" means that the parts before and after "*@" are being corrected.

[0050] First, the addition unit 1313 prepares a priority queue Q and adds the parameters given in the input to Q. The parameters are the regular expression "(?<!#)\[(1.*)1\].*\[\1\]" and the substitution pattern "$1:$2" in (2).

[0051] At this time, the addition unit 1313 stores the templates enumerated based on the parameters in Q. FIG. 6 is a diagram for explaining the enumeration of templates. The addition unit 1313 performs addition, reduction, and expansion of holes and enumerates templates with changed forms. For example, based on the parameter "(a,b)", the addition unit 1313 can enumerate "(□,b)" and "(a,□)" with holes added as templates. Also, based on the template "(□,b)", the addition unit 1313 can enumerate "(□□,b)", "(□*,b)" with holes expanded, and "(□,□)" with holes added as templates. Also, based on the template "(□*,b)", the addition unit 1313 can enumerate "(□,b)" with holes reduced as a template.

[0052] FIG. 7 is a diagram for explaining the enumeration of templates. Based on the regular expression "(?<!#)\[(1.*)1\].*\[\1\]" and the substitution pattern "$1:$2" in (2), the addition unit 1313 can perform the enumeration of templates as shown in FIG. 7.

[0053] The information processing apparatus 10 enumerates templates with a part of the regular expression and pattern information changed, and based on the templates among the enumerated templates such that the second string is obtained as a result of the function operating on the first string, corrects the regular expression and pattern information.

[0054] The construction unit 1311 extracts the templates (t1, t2) from Q. Here, t1 is a regular expression and t2 is a replacement pattern. For example, the construction unit 1311 extracts the templates in the order of the shortest distance from the parameters (the order of the fewest number of addition, reduction, and expansion).

[0055] Then, the construction unit 1311 constructs a constraint formula φ for (t1, t2) to satisfy the example. The constraint formula φ constructs a constraint formula for SMT (Satisfiability Modulo Theories) Constraint Solving.

[0056] The construction unit 1311 constructs a constraint formula for determining whether the parameter satisfies the example when the hole in the regular expression is replaced with the range character "[C]" and the hole in the replacement pattern is replaced with the character "a" or the reference "$i". However, when the hole in the replacement pattern is replaced with "$i", a capture "( i ・) i " is inserted if necessary. In other words, the construction unit 1311 encodes the above determination into the SMT constraint formula.

[0057] Suppose the extracted template is "(?<!#)\[(1□*)1\].*\[\1\],$1:□)". Adding a suffix to distinguish the holes in the template results in "(?<!#)\[(1□1*)1\].*\[\1\],$1:□2)". The constraint formula is composed of the following bool variables. The suffix of the hole is represented by i.

[0058] The bool variable for the regular expression is v i a . For v i a ", "true is assigned to v i a iff the [C] corresponding to i accepts a" holds. For example, when "a" is included in the range character "[C]", "[C] accepts a" holds.

[0059] For example, v1 a = true, v1 zIf it is = true, then “(?<!#)\[(1□1*)1\].*\[\1\],$1:□2)” is specified as “(?<!#)\[(1[az]*)1\].*\[\1\],$1:□2)”.

[0060] The bool variable for the replacement pattern is v i a , v i $j , v i $ct is. For v i a , “v i a is assigned true iff □ i is a” holds. For v i $j , “v i $j is assigned true iff □ i is $j” holds. For v i $ct , “v i $ct is assigned true iff □ i is $ct and t covers with capture” holds. ct is the suffix of the sub-expression of the regular expression.

[0061] For example, if v2 a = true, then “((?<!#)\[(1□’)1\].*\[\1\],$1:□2)” is specified as “((?<!#)\[(1□’*)1\].*\[\1\],$1:a)”.

[0062] For example, if v2 $1 = true, then “((?<!#)\[(1□’*)1\].*\[\1\],$1:□2)” is specified as “((?<!#)\[(1□’*)1\].*\[\1\],$1:$1)”.

[0063] For example, if v2 $c1 = true, then “((?<!#)\[(1□’*)1\].*\[\1\],$1:□2)” is “((?<!#)\[(1□’*)1\]( c1 .*) c1It is embodied in "\1\],$1:$c1)". c1 is an index corresponding to ".*" in the regular expression template.

[0064] Furthermore, the construction unit 1311 mimics the behavior of the replaceAll function and calculates the conditions for the parameters to match the example using the above bool variable. At this time, the construction unit 1311 adds constraints so that true is not assigned to two different bool variables corresponding to □ in the replacement pattern. Also, when inserting a capture, the construction unit 1311 adds a constraint so that no overlap occurs. i To explain the constraint for preventing overlap. Let the regular expression template be "abc" and the replacement pattern template be "□1□2". The set of examples is as shown in FIG. 8. FIG. 8 is a diagram showing the set of examples.

[0065] Here, to modify the replacement pattern to obtain "abbc", there is no choice but to change "□1□2" to "$1$2" and make "$1" and "$2" refer to "ab" and "bc" in the regular expression template respectively. However, if such a modification is made, the regular expression template becomes "(1a(2b)1c)2" and overlap occurs. To avoid such a situation, the construction unit 1311 adds a constraint not to insert a capture between partial expressions where overlap occurs when inserting a capture.

[0066] The determination unit 1312 determines the satisfiability of the constraint formula using an SMT solver. The determination unit 1312 determines that the template "((?<!#)\[(1□*)1\].*\[\1\],$1:□)" satisfies the constraint formula. The addition unit 1313 restores the parameters from the template according to the assignment to the constraint formula. The restored parameter is "((?<!#)\[(1[^\[\],]*)1\](2.*)2\[\1\],$1:$2)".

[0067] The modification process described so far is applicable not only to the replaceAll function but also to other functions such as the replace function and the search function.

[0068]

[0069] [Application to the replace function] The replace function behaves almost the same as the replaceAll function, but as in (3), it replaces only the first instance where the regular expression matches. "aaa".replace(a,X)=“Xaa” (3)

[0070] Therefore, the modification unit 131 can apply the modification process to the replace function by setting the size of example η to 1 or less and by not performing pruning and constraint equation generation in the modification algorithm beyond the position indicated by η.

[0071] [Application to the search function] As shown in (4), the search function takes a string and a regular expression and returns the starting position of the first substring that matches the regular expression. Also, as shown in (5), the search function returns -1 if no matching substring exists. "File:abc.png,#def.txt#,efg.txt,hij.svg".search([az] + [.]txt)=25 (4) "File: abc.png,#def.txt#,efg.txt,hij.svg".search([az] + [.]pdf)=-1 (5)

[0072] As shown in Figure 9, by entering the substring to be matched in the example η, the modification unit 131 can apply the modification process to the search function. Figure 9 is a diagram illustrating how to enter the substring. Figure 9 shows that the substring to be matched is "efg.txt". Note that the string corresponding to the replacement target only needs to be set to a fixed character (for example, "X").

[0073] If the substring to be matched does not exist, the example will be as in (6), and η will be an empty list. File:abc.png,#def.txt#,efg.txt,hij.svg → File:abc.png,#def.txt#,efg.txt,hij.svg (6)

[0074] [Processing Flow of the First Embodiment] Figure 10 is a flowchart showing the processing flow of the modification process. The information processing device 10 accepts the input of parameters and examples (step S101). The information processing device 10 prepares a priority queue Q whose elements consist only of the input parameters (step S102).

[0075] The information processing device 10 extracts elements from Q (step S103). The information processing device 10 checks whether the extracted template has an answer (step S104). That is, the information processing device 10 constructs a constraint equation and determines whether the parameters restored from the template satisfy the example according to the constraint equation.

[0076] If there is no answer (step S105; No), the information processing device 10 adds a modified version of the template to Q (enumeration of templates) (step S106), and returns to step S103.

[0077] If there is an answer (step S105; Yes), the information processing device 10 outputs the answer, i.e., the parameters that restore the template (step S107).

[0078] [Effects of the First Embodiment] As described above, the information processing device 10 receives input including a regular expression to be input to a function that manipulates strings, pattern information that specifies the operation of the function on the string that matches the regular expression, a combination of a first string and a second string, and mapping information that associates a part of the first string with a part of the second string. Based on the mapping information, the information processing device 10 modifies the regular expression and the pattern information so that the second string is obtained as a result of the function performing an operation on the first string.

[0079] This allows the information processing device 10 to automatically correct bugs in string manipulation functions based on examples. As a result, string manipulation will be performed as intended by the user. Furthermore, the information processing device 10 is expected to reduce security risks and development costs in web applications and other applications where string manipulation functions are incorporated.

[0080] [System Configuration, etc.] Furthermore, the components of each device shown in the diagram are functional concepts and do not necessarily have to be physically configured as shown. In other words, the specific forms of distribution and integration of each device are not limited to those shown in the diagram, and all or part of them can be functionally or physically distributed or integrated in any unit according to various loads and usage conditions. In addition, all or any part of the processing functions performed by each device can be realized by a CPU (Central Processing Unit) and a program that is analyzed and executed by the CPU, or by hardware using wired logic.

[0081] Furthermore, among the processes described in this embodiment, all or part of the processes described as being performed automatically may be performed manually, or all or part of the processes described as being performed manually may be performed automatically by known methods. In addition, the processing procedures, control procedures, specific names, various data and parameters shown in the above document or drawings may be changed as appropriate unless otherwise specified.

[0082] [Program] In one embodiment, the information processing device 10 can be implemented by installing a program that performs the above processing as packaged software or online software on a desired computer. For example, by having the information processing device execute the above program, the information processing device can be made to function as the information processing device 10. The information processing device referred to here includes desktop or notebook personal computers. In addition, the category of information processing device also includes mobile communication terminals such as smartphones and tablet PCs.

[0083] Furthermore, the information processing device 10 may be implemented as a server device that provides services related to the above processing to a terminal device used by a user, with the user's terminal device acting as the client. For example, the server device may be implemented as a server device that takes the regular expression before modification as input and outputs the regular expression after modification. In this case, the server device may be implemented as a web server, or it may be implemented as a cloud that provides services related to the above processing through outsourcing.

[0084] Figure 11 shows an example of a computer running a program. Computer 1000 has, for example, memory 1010 and a CPU 1020. Computer 1000 also has a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These components are connected by a bus 1080.

[0085] Memory 1010 includes ROM (Read Only Memory) 1011 and RAM (Random Access Memory) 1012. ROM 1011 stores, for example, a boot program such as BIOS (Basic Input Output System). The hard disk drive interface 1030 is connected to the hard disk drive 1090. The disk drive interface 1040 is connected to the disk drive 1100. For example, a removable storage medium such as a magnetic disk or optical disk is inserted into the disk drive 1100. The serial port interface 1050 is connected to, for example, a mouse 1110 and a keyboard 1120. The video adapter 1060 is connected to, for example, a display 1130.

[0086] The hard disk drive 1090 stores, for example, the OS 1091, application programs 1092, program modules 1093, and program data 1094. That is, the programs that define each process of the information processing device 10 are implemented as program modules 1093 in which executable code for the computer is written. The program modules 1093 are stored, for example, in the hard disk drive 1090. For example, a program module 1093 for performing processes similar to the functional configuration of the information processing device 10 is stored in the hard disk drive 1090. Note that the hard disk drive 1090 may be replaced by an SSD (Solid State Drive).

[0087] Furthermore, the configuration data used in the processing of the above-described embodiment is stored as program data 1094 in, for example, memory 1010 or hard disk drive 1090. The CPU 1020 then reads the program module 1093 and program data 1094 stored in memory 1010 or hard disk drive 1090 into RAM 1012 as needed and executes the processing of the above-described embodiment.

[0088] Furthermore, the program module 1093 and program data 1094 are not limited to being stored in the hard disk drive 1090; for example, they may be stored in a removable storage medium and read by the CPU 1020 via a disk drive 1100 or the like. Alternatively, the program module 1093 and program data 1094 may be stored in another computer connected via a network (LAN (Local Area Network), WAN (Wide Area Network), etc.). The program module 1093 and program data 1094 may then be read by the CPU 1020 from the other computer via a network interface 1070.

[0089] 10 Information processing device 11 Input / output unit 12 Storage unit 13 Control unit 121 Template information 131 Modification unit 132 Execution unit 1311 Construction unit 1312 Determination unit 1313 Addition unit

Claims

1. An information processing device characterized by having: an input unit that receives input of a regular expression to be input to a function for manipulating strings, pattern information that specifies the operation of the function on the string that matches the regular expression, a combination of a first string and a second string, and mapping information that associates a part of the first string with a part of the second string; and a modification unit that modifies the regular expression and the pattern information based on the mapping information so that the second string is obtained as a result of the function performing an operation on the first string.

2. The information processing apparatus according to claim 1, wherein the input unit receives input of a regular expression to be input to the function for replacing a string, pattern information that identifies the replacement string for the string that matches the regular expression, and mapping information, and the modification unit modifies the regular expression and the pattern information so that the function replaces the portion of the first string with the portion of the second string that is mapped by the mapping information.

3. The information processing apparatus according to claim 1, characterized in that the modification unit enumerates templates in which a part of the regular expression and the pattern information has been changed, and modifies the regular expression and the pattern information based on the template, from among the enumerated templates, so that the second string is obtained as a result of the function performing an operation on the first string.

4. An information processing method performed by a computer, comprising: an input step of receiving input of a regular expression to be input to a function for manipulating strings; pattern information that specifies an operation of the function on a string that matches the regular expression; a combination of a first string and a second string; and mapping information that associates a part of the first string with a part of the second string; and a modification step of modifying the regular expression and the pattern information based on the mapping information so that the function obtains the second string as a result of performing an operation on the first string.

Citation Information

Patent Citations

  • Character-string substitution system with attribute

    JP1991266066A

  • Text correction device and text correction method

    JP2020197592A

  • Information representation structure analysis device, and information representation structure analysis method

    WO2022215433A1