A data processing method, device and related equipment

By dividing the content strings of template files in the template engine and generating target command strings, the problem of low parsing efficiency of different template files is solved, and efficient parsing of multiple template files and improving system security is achieved.

CN110210212BActive Publication Date: 2024-11-08TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910194598.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-03-14
Publication Date
2024-11-08
Estimated Expiration
2040-03-03

AI Technical Summary

Technical Problem

The existing template engine can only parse matching template files. Template files of different file types and different template languages ​​need to be parsed separately, resulting in reduced parsing efficiency.

Method used

By dividing the content string of the template file into a logical operation type character sequence and a general character sequence, extracting a logical string and a general character sequence, generating a target command string, and running the command string in a safe sandbox To obtain matching code output results, realize efficient parsing of different template files.

Benefits of technology

It realizes efficient parsing of many different types of template files, improves template file parsing efficiency, and runs function code in an independent sandbox environment, enhancing system security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110210212B_ABST
    Figure CN110210212B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a data processing method, device and related equipment, the data processing method comprising: obtaining a target template file sent by a front-end device, dividing the target content string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type; extracting a logical string from the first character sequence, generating a target command string for executing a command according to the logical string and the second character sequence; generating an executable function code according to the target command string in a target security sandbox, and obtaining a code output result matching the target template file based on the executable function code, and sending the code output result to the front-end device so that the front-end device displays the code output result. The present invention can improve the efficiency of parsing template files and ensure security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a data processing method, device and related equipment. Background Art

[0002] The template engine is created to separate the user interface from the business data (content). For example, after parsing the template file and business data of the website program through the template engine, standard HTML (HyperText Markup Language) program code can be generated. Therefore, the coupling between the interface code and the data generation code can be reduced through the template engine. The template engine can not only improve the efficiency of program development, but also improve the reusability of the program with good design.

[0003] Existing template engines mainly process template files of HTML data type and generate HTML program code after parsing. Before parsing, it is first necessary to detect whether the file type and template language of the template file match the template engine. Only when they match can the template engine parse the template file and generate HTML program code.

[0004] As can be seen from the above, the existing template engine parsing technology can only parse matching template files. Template files of different file types and different template languages ​​need to be parsed by different template engines. When there are multiple template files of different types that need to be parsed, the corresponding template engine needs to be called, thereby reducing the parsing efficiency of the template files. Summary of the invention

[0005] The embodiments of the present invention provide a data processing method, an apparatus and related equipment, which can parse template files of different file types and improve the efficiency of parsing template files.

[0006] An embodiment of the present invention provides a data processing method, including:

[0007] Acquire a target template file sent by a front-end device, and divide a target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type;

[0008] Extracting a logical string from the first character sequence, and generating a target command string for executing a command according to the logical string and the second character sequence;

[0009] Generate an executable function code in the target security sandbox according to the target command string, obtain a code output result matching the target template file by running the executable function code in the target security sandbox, and send the code output result to the front-end device so that the front-end device displays the code output result.

[0010] Wherein, the logic string includes an expression string and a variable string;

[0011] The step of generating a target command string for executing a command according to the logic string and the second character sequence comprises:

[0012] Generate a first command string for executing a first command, wherein the first command is a command for creating a target array;

[0013] generating a second command string for executing a second command according to the variable string, wherein the second command is a command for adding a variable to the target array;

[0014] Generate a third command string for executing a third command according to the second character sequence, wherein the third command is a command for adding the second character sequence to the target array;

[0015] The first command string, the second command string, the third command string and the expression string are combined into the target command string according to the position information of the variable string, the second character sequence and the expression string in the target content string.

[0016] The step of generating an executable function code according to the target command string in the target security sandbox, obtaining a code output result matching the target template file by running the executable function code in the target security sandbox, and sending the code output result to the front-end device so that the front-end device displays the code output result includes:

[0017] Create at least one security sandbox based on the container engine and the environment image, and select a target security sandbox that meets the load balancing condition from the at least one security sandbox;

[0018] Generate an internal sending request, send the internal sending request carrying the target command string to the target security sandbox, call a function to generate an object in the target security sandbox, and convert the target command string into an executable function code;

[0019] Running the first command, the second command, and the third command corresponding to the executable function code in the target security sandbox, and combining array elements in the target array into the code output result;

[0020] When a normal result message fed back by the target security sandbox is obtained, the code output result sent by the target security sandbox is received, and the code output result is forwarded to the front-end device, so that the front-end device displays the code output result.

[0021] Among them, it also includes:

[0022] When the abnormal result message fed back by the target security sandbox is obtained, the execution of the executable function code is stopped, and the process corresponding to the target security sandbox is closed, an abnormal prompt message is generated, and the abnormal prompt message is forwarded to the front-end device.

[0023] The step of running the first command, the second command, and the third command corresponding to the executable function code in the target security sandbox, and combining the array elements in the target array into the code output result, includes:

[0024] Running the first command in the target security sandbox to create the target array;

[0025] Acquire an input parameter corresponding to a target variable in the variable string, and send the input parameter to the target security sandbox according to the internal sending request;

[0026] Running the second command in the target security sandbox to generate a result variable value corresponding to the input parameter and the target variable, and adding the result variable value as an array element to the target array;

[0027] Running the third command in the target security sandbox to add the second character sequence as an array element to the target array;

[0028] All array elements in the target array are combined into the code output result.

[0029] The step of obtaining the input parameter corresponding to the target variable in the variable character string includes:

[0030] receiving an input variable value corresponding to the target variable in the variable string, and determining the input variable value as the input parameter; or,

[0031] An interface variable value is generated according to a target user interface, and the interface variable value is determined as the input parameter; the interface variable value is generated according to the user's operation behavior in the target user interface.

[0032] The step of dividing the target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type includes:

[0033] Reading a plurality of content characters contained in the target template file as the target content character string;

[0034] Obtaining a logical matching pattern; the logical matching pattern includes a logical character pair;

[0035] Determine in the target content character string a matching character pair that satisfies a regular matching rule with the logical character pair; the matching character pair includes a first matching character and a second matching character;

[0036] Taking the first matching character as the starting point of the character sequence and the second matching character as the ending point of the character sequence, extracting a character sequence from the target content character string as the first character sequence;

[0037] The character sequence in the target content character string except the first character sequence is used as the second character sequence.

[0038] The step of taking a character sequence other than the first character sequence in the target content character string as the second character sequence includes:

[0039] Obtaining the first position subscript of the first matching character in the target content string as the starting subscript, and obtaining the first position subscript of the second matching character in the target content string as the ending subscript;

[0040] Obtain the position subscript of the first character in the target content string as a cursor;

[0041] Taking the character sequence between the cursor and the starting subscript as the first target subsequence;

[0042] Determine the position subscript adjacent to the end subscript as the cursor, determine the next start subscript according to the first matching character, and determine the next end subscript according to the second matching character, until all first target subsequences in the target content character string are determined;

[0043] Taking a character sequence in the position subscript interval between the cursor and the last character in the target content character string as a second target subsequence;

[0044] All first target subsequences and the second target subsequences are determined as the second character sequence.

[0045] Wherein, the logic string includes an expression string and a variable string;

[0046] The step of extracting a logical string from the first character sequence comprises:

[0047] taking the character string between the matching character pairs in the first character sequence as the character string to be determined;

[0048] If the character string to be determined contains a logical keyword, the character string to be determined is determined as the expression character string;

[0049] If the character string to be determined includes a target variable identifier, the character string in the character string to be determined except for the target variable identifier is determined as the variable character string.

[0050] The step of obtaining the target template file sent by the front-end device includes:

[0051] Obtaining the original template file sent by the front-end device;

[0052] Extracting a template variable identifier corresponding to a variable in the original template file, and extracting a template expression identifier corresponding to an expression in the original template file;

[0053] If the template variable identifier and the template expression identifier are both the same as the logical character pair, the original template file is determined as the target template file.

[0054] Another aspect of the present invention provides a data processing device, including:

[0055] An acquisition module is used to acquire the target template file sent by the front-end device;

[0056] A division module, used for dividing the target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type;

[0057] An extraction module, used for extracting a logical string from the first character sequence;

[0058] A generating module, used for generating a target command string for executing a command according to the logic string and the second character sequence;

[0059] An operation module is used to generate an executable function code in a target security sandbox according to the target command string, and obtain a code output result matching the target template file by running the executable function code in the target security sandbox, and send the code output result to the front-end device so that the front-end device displays the code output result.

[0060] Wherein, the logic string includes an expression string and a variable string;

[0061] The generating module comprises:

[0062] A generating unit, configured to generate a first command string for executing a first command, wherein the first command is a command for creating a target array;

[0063] The generating unit is further used to generate a second command string for executing a second command according to the variable string, wherein the second command is a command for adding a variable to the target array;

[0064] The generating unit is further used to generate a third command string for executing a third command according to the second character sequence, wherein the third command is a command for adding the second character sequence to the target array;

[0065] A combining unit is used to combine the first command string, the second command string, the third command string and the expression string into the target command string according to the position information of the variable string, the second character sequence and the expression string in the target content string.

[0066] Wherein, the operation module includes:

[0067] A selection unit, configured to create at least one security sandbox based on the container engine and the environment image, and select a target security sandbox that meets the load balancing condition from the at least one security sandbox;

[0068] A conversion unit, configured to generate an internal sending request, send the internal sending request carrying the target command string to the target security sandbox, call a function to generate an object in the target security sandbox, and convert the target command string into an executable function code;

[0069] an execution unit, configured to execute the first command, the second command, and the third command corresponding to the executable function code in the target security sandbox, and combine array elements in the target array into the code output result;

[0070] The receiving unit is used to receive the code output result sent by the target security sandbox when a normal result message fed back by the target security sandbox is obtained, and forward the code output result to the front-end device so that the front-end device displays the code output result.

[0071] Among them, it also includes:

[0072] The stopping unit is used to stop running the executable function code and close the process corresponding to the target security sandbox when obtaining the abnormal result message fed back by the target security sandbox, generate an abnormal prompt message, and forward the abnormal prompt message to the front-end device.

[0073] Wherein, the operating unit includes:

[0074] An execution subunit, configured to execute the first command in the target security sandbox to create the target array;

[0075] An acquisition subunit, used for acquiring an input parameter corresponding to a target variable in the variable string;

[0076] The running subunit is further configured to send the input parameter to the target security sandbox according to the internal sending request;

[0077] The execution subunit is further configured to execute the second command in the target security sandbox to generate a result variable value corresponding to the input parameter and the target variable, and add the result variable value as an array element to the target array;

[0078] The execution subunit is further configured to execute the third command in the target security sandbox to add the second character sequence as an array element to the target array;

[0079] The running subunit is further used to combine all array elements in the target array into the code output result.

[0080] Wherein, the acquisition subunit includes:

[0081] a receiving subunit, configured to receive an input variable value corresponding to a target variable in the variable string, and determine the input variable value as the input parameter; or,

[0082] The generating subunit is used to generate an interface variable value according to a target user interface and determine the interface variable value as the input parameter; the interface variable value is generated according to the user's operation behavior in the target user interface.

[0083] Wherein, the division module includes:

[0084] A reading unit, used for reading a plurality of content characters contained in the target template file as the target content character string;

[0085] The reading unit is further used to obtain a logical matching pattern; the logical matching pattern includes a logical character pair;

[0086] A matching unit, configured to determine a matching character pair in the target content string that satisfies a regular matching rule with the logical character pair; the matching character pair includes a first matching character and a second matching character;

[0087] The matching unit is further configured to extract a character sequence from the target content character string, using the first matching character as a starting point of the character sequence and the second matching character as an end point of the character sequence, as the first character sequence;

[0088] The first determining unit is configured to use a character sequence other than the first character sequence in the target content character string as the second character sequence.

[0089] Wherein, the first determining unit includes:

[0090] A first determining subunit is configured to obtain a first position subscript of the first matching character in the target content string as a start subscript, and obtain a first position subscript of the second matching character in the target content string as an end subscript;

[0091] The first determining subunit is further used to obtain the position subscript of the first character in the target content string as a cursor;

[0092] The first determining sub-unit is further configured to use a character sequence in the interval between the cursor and the starting subscript as a first target sub-sequence;

[0093] The first determining sub-unit is further configured to determine the position subscript adjacent to the end subscript as the cursor, determine the next start subscript according to the first matching character, and determine the next end subscript according to the second matching character, until all first target subsequences in the target content character string are determined;

[0094] The first determining subunit is further configured to use a character sequence in a position subscript interval between the cursor and the last character in the target content character string as a second target subsequence;

[0095] The second determining subunit is configured to determine all first target subsequences and the second target subsequences as the second character sequence.

[0096] Wherein, the logic string includes an expression string and a variable string;

[0097] The extraction module comprises:

[0098] A second determining unit, configured to take the character string between the matching character pairs in the first character sequence as the character string to be determined;

[0099] The second determining unit is further configured to determine the character string to be determined as the expression character string if the character string to be determined contains a logical keyword;

[0100] The third determining unit is configured to determine, if the to-be-determined character string includes a target variable identifier, a character string other than the target variable identifier in the to-be-determined character string as the variable character string.

[0101] Wherein, the acquisition module includes:

[0102] An acquisition unit, used for acquiring the original template file sent by the front-end device;

[0103] The acquisition unit is further used to extract the template variable identifier corresponding to the variable in the original template file, and extract the template expression identifier corresponding to the expression in the original template file;

[0104] The fourth determining unit is configured to determine the original template file as the target template file if the template variable identifier and the template expression identifier are both the same as the logical character pair.

[0105] Another aspect of an embodiment of the present invention provides an electronic device, including: a processor and a memory;

[0106] The processor is connected to a memory, wherein the memory is used to store program codes, and the processor is used to call the program codes to execute a method as in one aspect of an embodiment of the present invention.

[0107] Another aspect of an embodiment of the present invention provides a computer storage medium, wherein the computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method in one aspect of an embodiment of the present invention is executed.

[0108] The embodiment of the present invention divides the content string contained in the template file into a first character sequence and a second character sequence, and then extracts a logical string from the first character sequence, and generates a target command string according to the logical string and the second character sequence; converts the target command string into an executable function code in a security sandbox, and runs the function code to obtain a code output result. As can be seen from the above, by identifying the logical part (i.e., the first character sequence) and the non-logical part (i.e., the second character sequence) in the template file, corresponding function code statements (i.e., the target command string) are generated respectively to parse the template file without paying attention to the file type and template language of the template file. The highly versatile template file parsing method can parse a variety of different types of template files, especially when there are multiple different types of template files that need to be parsed, the versatile template parsing method can improve the parsing efficiency of the template file; further, running the function code in an independent sandbox environment can isolate the host system and improve system security. BRIEF DESCRIPTION OF THE DRAWINGS

[0109] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0110] Figure 1 is a system architecture diagram of data processing provided by an embodiment of the present invention;

[0111] Figure 2a-2b is a schematic diagram of a data processing scenario provided by an embodiment of the present invention;

[0112] Figure 3a It is a flowchart of a data processing method provided by an embodiment of the present invention;

[0113] Figure 3b is a schematic diagram of determining a first character sequence and a second character sequence provided by an embodiment of the present invention;

[0114] Figure 4 This is a schematic diagram of a process for determining a target command string provided by the sending embodiment;

[0115] Figure 5 is a schematic diagram of determining a code output result provided by an embodiment of the present invention;

[0116] Figure 6 is an interactive schematic diagram of data processing provided by an embodiment of the present invention;

[0117] Figure 7is a structural schematic diagram of a data processing device provided by an embodiment of the present invention;

[0118] Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0119] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0120] See also Figure 1 , is a system architecture diagram of data processing provided by an embodiment of the present invention. The server 10f establishes a connection with a user terminal cluster through a switch 10e and a communication bus 10d. The user terminal cluster may include: user terminal 10a, user terminal 10b, ..., user terminal 10c.

[0121] Taking the user terminal 10a as an example, when the user terminal 10a receives the template file to be parsed, the user terminal 10a sends the template file to be parsed to the server 10f. The server 10f generates a command string according to the content string contained in the template file to be parsed, converts the command string into a function code in the sandbox, and runs the function code to obtain a code output result. The server 10f sends the parsed code output result to the user terminal 10a, and the user terminal 10a can subsequently display the code output result on the screen.

[0122] Of course, if the user terminal 10a has the function of parsing the template file, the user terminal 10a can also directly parse the template file to obtain the code output result, and also display the parsed code output result on the screen. The following is a specific description of how the user terminal 10a and the server 10f parse the template file according to the content string contained in the template file.

[0123] in, Figure 1 The user terminals 10a, 10b, 10c, etc. shown may include mobile phones, tablet computers, laptop computers, PDAs, mobile Internet devices (MIDs), wearable devices (such as smart watches, smart bracelets, etc.), etc.

[0124] See also Figure 2a-2b , is a schematic diagram of a data processing scenario provided by an embodiment of the present invention. Figure 2aAs shown, the user inputs the template file 20a to be parsed into the user terminal 10a, and the user terminal 10a sends the template file 20a to the server 10f. The server 10f obtains the logical character pair <%%> used to identify the logical part, and the character string contained in the template file 20a can be divided into a character sequence 20c belonging to the logical operation type and a character sequence 20b of the general character type according to the above logical character pair. Among them, the character sequence with the logical character pair as the starting point and the end point of the character sequence in the template file 20a belongs to the character sequence of the logical operation type; correspondingly, the character sequences in the template file 20a except the character sequence belonging to the logical operation type all belong to the general character sequence. In other words, the logical part in the template file 20a is identified by the logical character pair "<%%>".

[0125] For the character sequence 20c, the server 10f takes the character string between the logical character pair “<% %>” as the character string to be determined, and thus two character strings to be determined can be determined, namely “var c=”; c=a+b” and “=c”. For the character string to be determined “var c=”; c=a+b;”, there is the logical keyword “var”, so the character string “var c=”; c=a+b;” is an expression character string; for the character string to be determined “=c”, there is a variable identifier “=”, so the characters in the character string “=c” except the variable identifier “=” are taken as variable character strings, that is, “c” is a variable character string.

[0126] Next, the server 10f generates a command string according to the character sequence 20b, the expression string "var c="; c = a+b;", and the order of the variable string "c" in the template file 20a.

[0127] First, the server 10f generates a command string for creating an array r: var r = [];

[0128] Since the string "Please calculate the sum of a+b?" belongs to the general character type, the server 10f generates a command string for adding the string "Please calculate the sum of a+b?" to the array r: r.push(`Please calculate the sum of a+b?`);

[0129] Since the string "var c="; c="a+b;" is an expression string, the server 10f directly uses the above expression string as the command string: var c="; c="a+b;"

[0130] Since the string "answer:" belongs to the universal character sequence, the server 10f generates a command string for adding the string "answer:" to the array r: r.push(`answer:`);

[0131] Since the character string "c" belongs to a variable character string, the server 10f generates a command string for adding the variable c to the array r: r.push(c);

[0132] The server 10f combines the above multiple command strings into a command string set 20d:

[0133] var r = [];

[0134] r.push(`Please calculate the sum of a+b?`);

[0135] var c = ";

[0136] c = a + b;

[0137] r.push(`answer:`);

[0138] r.push(c);

[0139] The server 10f creates multiple sandboxes, selects a sandbox that meets the load balancing condition from the multiple sandboxes as a target sandbox, and sends the command string set 20d to the target sandbox. In the target sandbox, the command string set 20d is converted into an executable function code, that is, the function object is called to use the string in the string set 20d as the function body to generate an executable function that meets the grammatical rules of the programming language.

[0140] Server 10f obtains input parameters 20e: a=1, b=2, and runs the executable function in the target sandbox, that is, executes the commands corresponding to the above multiple command strings in sequence: first, array r is created, and the string "Please calculate the sum of a+b?" is added to array r; then the value of variable c is calculated to be 3 according to output parameters a and b; the string "Answer:" is added to array r; finally, the value of variable c is added to array r, that is, the value 3 is added to array r. Finally, server 10f combines all elements in array r into code output result 20f: Please calculate the sum of a+b? Answer: 3.

[0141] like Figure 2b As shown, the server 10f sends the code output result 20f to the user terminal 10a. As shown in the interface 20k, the user terminal 10a can display the code output result 20f on the screen.

[0142] The character string contained in the template file is divided into a first character sequence (such as Figure 2a The character sequence 20c in the corresponding embodiment) and the second character sequence (such as Figure 2a The specific process of character sequence 20b), generating command string, creating sandbox, and determining code output result in the corresponding embodiment can be seen in the following Figures 3a to 6 The corresponding embodiment.

[0143] The present invention relates to a universal template parsing engine that can parse various types of template files. The template parsing engine can be integrated into any system that requires a template parsing engine, or can be used as independent software or app (Application). The working principle of the template parsing engine of the present invention can be found in Figure 3a , is a flow chart of a data processing method provided by an embodiment of the present invention. Figure 3a As shown, the data processing method may include:

[0144] Step S101, obtaining a target template file sent by a front-end device, and dividing a target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type.

[0145] Specifically, the backend device (such as the above Figure 2a-2b The server 10f in the corresponding embodiment obtains the front-end device (as described above) Figure 2a-2b The template file to be parsed (such as the above) sent by the user terminal 10a in the corresponding embodiment Figure 2a The template file 20a) in the corresponding embodiment is called a target template file. A plurality of content characters contained in the target template file are read as a target content character string. Of course, the back-end device and the front-end device may also be the same intelligent terminal.

[0146] The backend device divides the target content string into a first character sequence belonging to a logical operation type (such as Figure 2a The character sequence 20c in the corresponding embodiment) and the second character sequence belonging to the universal character type (such as Figure 2a The character sequence 20b) in the corresponding embodiment, wherein the character sequence of logical operation or logical variable belongs to the logical operation type; the regular character string or the character sequence not involving logic belongs to the general character type.

[0147] How to determine the first character sequence is described in detail below: The backend device obtains a logical matching pattern, which may include a logical character pair (such as Figure 2a The logical character pair <%%> in the corresponding embodiment is used to identify the logical operation part or the logical variable part in the template file. For example, the characters between the logical character pair are logical operation characters or logical variable characters, and the logical character pair can be <%%>, {%%} or {{}}, etc.

[0148] The back-end device performs regular matching on the logical character pair and the target content string, that is, searches for the character pair that is identical to the logical character pair in the target content string, which is called a matching character pair. It can be seen that the matching character pair includes two characters, namely the first matching character and the second matching character, where in the target content string, the first matching character string comes first and the second matching character comes last in the reading order.

[0149] The backend device extracts a character sequence from the target content string as a first character sequence, wherein the first character sequence is a character sequence with the first matching character as the starting point of the character sequence and the second matching character as the ending point of the character sequence. Since the first matching character and the second matching character are used to identify the logical operation or logical variable in the target content string, the first character sequence can also be referred to as a character sequence belonging to the logical operation type. At this point, the backend device determines the logical part (i.e., the first character sequence) in the target content string based on the logical character pair.

[0150] The backend device uses the character sequence other than the first character sequence in the target content string as the second character sequence (as described above). Figure 2a The corresponding embodiment has a character sequence 20b).

[0151] Since the first character sequence is a character sequence belonging to a logical operation type, the corresponding second character sequence is a regular character string or a character sequence not involving logic, which can also be called a character sequence belonging to a universal character type.

[0152] The following is a specific description of how to determine the second character sequence based on the matching character pair: obtain the first position subscript of the first first matching character in the target content string as the starting subscript, and correspondingly obtain the first position subscript of the first second matching character (the first second matching character here and the first first matching character mentioned above are a matching character pair) in the target content string as the ending subscript. Obtain the position subscript of the character at the first position in the target content string as the cursor. The back-end device uses the character sequence in the interval between the cursor and the starting subscript (the interval is a left-closed and right-open interval) as the first target subsequence.

[0153] In this way, a first target subsequence is determined, and the back-end device uses the position subscript adjacent to the end subscript as the cursor, that is, the cursor = end subscript + 1, determines the next start subscript according to the first matching character in the next matching character pair, and determines the next end subscript according to the second matching character in the next matching character pair, and then uses the character sequence between the cursor and the start subscript as the first target subsequence, and then uses the current end subscript + 1 as the cursor, until all matching character pairs in the target content string are involved in the operation, that is, until all first target subsequences in the target content string are determined.

[0154] The backend device obtains the position subscript of the character at the last position in the target content string as the end subscript. The character sequence at the last determined cursor (that is, the position subscript obtained by adding 1 to the position subscript of the second matching character in the last matching character pair) and the above end subscript interval (the interval is a left-closed and right-closed interval) is used as the second target subsequence; of course, if the position subscript of the second matching character in the last matching character pair is the same as the end subscript, then the second target subsequence is empty (this is because the cursor = end subscript + 1, and the current end subscript is already the end, so there is no cursor), and correspondingly, all the first target subsequences only need to be determined as the second character sequence.

[0155] The backend device determines all the first target subsequences and the second target subsequences as the second character sequence.

[0156] It should be noted that when the target content string is divided into the first character sequence and the second character sequence, the special characters such as space characters, line breaks, tab characters, etc. in the target content string are retained. By retaining the above special characters, it can be ensured that the file format and file layout of the target template file before parsing are completely consistent with the file format and file layout of the result file obtained after parsing (that is, the code output result), especially when the target template file belongs to a configuration file, this consistency in file format and file layout can ensure that the result file obtained after parsing can be directly used without any adjustment in content layout or conversion in content format.

[0157] See also Figure 3b , is a schematic diagram of determining a first character sequence and a second character sequence provided by an embodiment of the present invention, such as Figure 3bAs shown, the target content string is: "aa<%=bbbb%>c<%=ddd%>eeeeee" and the logical character pair is: <%%>. Regular matching is performed between the logical character pair and the characters in the target content string. Two matching character pairs can be determined in the target content string, namely, the matching character pair <%%> corresponding to <%=bbbb%>, and the matching character pair <%%> corresponding to <%=ddd%>. After determining the matching character pairs, the backend device can use the first matching character and the second matching character in the matching characters as the starting point and the end point, respectively, to determine two first character sequences, namely: "<%=bbbb%>" and "<%=ddd%>".

[0158] For the first matching character pair "<%=bbbb%>", the starting subscript is the position subscript of the character "<%", the starting subscript = 2, the ending subscript is the position subscript of the character "%>", the ending subscript = 8, and the current cursor is the position subscript of the character at the first position, the cursor = 0, and the character sequence in the interval between the cursor and the starting subscript (the interval is a left-closed and right-open interval) can be used as the first target subsequence: aa. Set the cursor to the ending subscript + 1, and the current cursor = 9.

[0159] For the second matching character pair "<%=ddd%>", the starting subscript is the position subscript of the character "<%", the starting subscript = 10, the ending subscript is the position subscript of the character "%>", the ending subscript = 15, and the cursor = 9. The character sequence in the interval between the cursor and the starting subscript (the interval is a left-closed and right-open interval) can be used as the first target subsequence: c, then there are currently two first target subsequences: "aa", "c". Then set the cursor to the ending subscript + 1, and the current cursor = 16.

[0160] The end subscript is the position subscript of the character at the end position, the end subscript = 20, and the end subscript is different from the position subscript corresponding to the second character in the last matching character pair (that is, the current end subscript 15 is different from the end subscript 20), and the character sequence in the interval between the cursor and the end subscript (the interval is a left-closed and right-closed interval) is taken as the second target subsequence: "eeeee". Therefore, the second character sequence includes 2 first target sequences: "aa", "c" and 1 second target sequence: "eeeee".

[0161] Optionally, after the front-end device sends the template file to be parsed to the back-end device, the back-end device needs to detect whether the logical part in the template file to be parsed is identified by logical character pairs. Only when the logical part in the template file is identified by logical character pairs can the back-end device perform subsequent parsing operations.

[0162] The specific process of detection is: obtain the original template file sent by the front-end device, extract the template variable identifier used to identify the variable (also called logical variable) in the original template file, and extract the template expression identifier used to identify the expression (also called logical operation). If the template variable identifier and the template expression identifier in the original template file are the same as the logical character pair, the back-end device can determine the original template file as the target template file, and then perform subsequent template file parsing operations. Of course, if the template variable identifier or the template expression identifier in the original template file is not the same as the logical character pair, it means that the back-end device cannot parse the original template file, and a prompt message can be sent to the front-end device. The prompt message is used to prompt the user that the original template file does not meet the requirements and needs to be modified again.

[0163] For example, in the original template file, {% %} is used to identify the variable c: {% = c %}, that is, the template variable identifier is {% %}. If the logical character pair is <% %>, since the template variable identifier "{% %}" is different from the logical character pair "<% %>", the subsequent parsing operation cannot be performed on the original template file.

[0164] Step S102: extracting a logical character string from the first character sequence.

[0165] Specifically, the backend device uses the character string between the matching character pairs in the first character sequence as the character string to be determined. Each character string to be determined is detected separately. If the character string to be determined includes a logical keyword, the character string to be determined can be determined as an expression string, where the logical keyword can be: if, for, else, switch, case, break or var, etc.

[0166] If the string to be determined contains a target variable identifier, the string other than the target variable identifier in the string to be determined can be used as the variable string. The target variable identifier can be: ""

[0167] =.

[0168] If the character string to be determined does not contain either a logical keyword or a target variable identifier, the backend device may directly determine the character string to be determined as a variable character string. The backend device may determine both the expression character string and the variable character string determined from the first character sequence as a logical character string, that is, the logical character string may include the expression character string and the variable character string.

[0169] For example, the two first character sequences are: "<%=name%>", and "<%var result="; if((a+b)===c)%>". For the first character sequence "<%=name%>", the character string to be determined "=name" is extracted. Since the character string to be determined includes the target variable identifier "=", the back-end device can use the character string other than the target variable identifier in the above character string to be determined as the variable string, that is, the character string "name" is the variable string; for the first character sequence "<%var result="; if((a+b)===c)%>", the character string to be determined "var result="; if((a+b)===c)" is extracted. Since the character string to be determined contains the logical keywords "var" and "if", the back-end device can directly use the character string to be determined as the expression string, that is, the character string "var result="; if((a+b)===c)" is the expression string.

[0170] Step S103: generating a target command string for executing a command according to the logic string and the second character sequence.

[0171] Specifically, the backend device first generates a first command string for executing a first command, wherein the first command is a command for creating a target array. For example, the first command string may be: var r=[]; or r=[]; wherein r is the name of the array.

[0172] For the variable string in the logic string, a second command string for executing the second command is generated, wherein the second command is a command for adding a variable to the target array. For example, the second command string may be: r.push(c); or r.input(c); or r.put(c); wherein "c" is the variable string and r is the target array.

[0173] For the second character sequence, a third command string is generated for executing the third command, wherein the third command is a command for adding the second character sequence to the target array. For example, the third command string may be: r.push(`Please calculate the sum of a+b?`); or r.input(`Please calculate the sum of a+b?`); or r.put(`Please calculate the sum of a+b?`); wherein "Please calculate the sum of a+b?" belongs to the second character sequence, and r is the target array. Of course, if the second character sequence includes multiple first target subsequences and one second target subsequence, then the backend device needs to generate a corresponding third command string for each first target subsequence and second target subsequence.

[0174] It can be known that each variable string has a corresponding second command string, and each first target subsequence and second target subsequence in the second character sequence has a corresponding third command string. Since the expression string is already an expression of logical operation, there is no need to generate a command string for the expression string, that is, the expression string is already a command string. It can be understood that if the target template file does not include the variable string, of course, there is no need to generate the second command string; if the target template file does not include the second character sequence, of course, there is no need to generate the third command string.

[0175] The back-end device combines the corresponding first command string, second command string, third command string and expression string into a target command string (such as Figure 2a The target command string is a code statement that satisfies the grammatical rules of the programming language and can be used as the function body of the function. The first command string is located at the first position in the target command string, and the remaining second command string, third command string and expression string are combined according to the positions of the corresponding variable string, second character sequence and expression string in the target content string.

[0176] For example, the target template file is:

[0177] Please calculate whether a+b equals c?

[0178] <%

[0179] var result = ";

[0180] if ((a+b) === c) {

[0181] result = 'equal to C'

[0182] }else{

[0183] result = 'not equal to C'

[0184] }

[0185] %>

[0186] Answer: <% = result%>

[0187] It can be known that "Please calculate whether a+b is equal to c?" and "Answer:" both belong to the first target subsequence in the second character sequence;

[0188] "var result = ";

[0189] if ((a+b) === c) {

[0190] result = 'equal to C'

[0191] }else{

[0192] result = 'not equal to C'

[0193] }" belongs to the expression string;

[0194] "result" belongs to the variable string.

[0195] The backend device first generates a first command string to create a target array r: var r = [];

[0196] Since the second character sequence includes two first target subsequences (the second target subsequence is empty in this example, that is, there is no second target subsequence), a third command string is generated to add the first target subsequence "Please calculate whether a+b is equal to c?" to the target array r: r.push(`Please calculate whether a+b is equal to c?`);

[0197] and generates a third command string for adding the first target subsequence "Answer:" to the target array r: r.push(`Answer:`);

[0198] Generate the second command string to add the variable result to the target array r: r.push(result);

[0199] According to the front and back position order of the first target subsequence, the expression string and the variable string in the target template file, the first command string, the second command string, the third command string and the expression string are combined into a target command string:

[0200] var r = [];

[0201] r.push(`Please calculate whether a+b is equal to c?`);

[0202] var result = ";

[0203] if ((a+b) === c) {

[0204] result = 'equal to C'

[0205] }else{

[0206] result = 'not equal to C'

[0207] }

[0208] r.push(`answer:`);

[0209] r.push(result);

[0210] The above method can retain the space characters in the target template file in the generated target command string. By retaining special characters such as line breaks and space characters, the target command string is kept consistent with the layout of the target template file. At the same time, the above target command string is a code statement that meets the grammatical rules of Javescript.

[0211] S104, generating an executable function code in the target security sandbox according to the target command string, and obtaining a code output result matching the target template file by running the executable function code in the target security sandbox, and sending the code output result to the front-end device so that the front-end device displays the code output result.

[0212] Specifically, the backend device creates multiple sandboxes (Sandboxie), called security sandboxes, where a sandbox is a virtual system program that creates an independent operating environment similar to a sandbox. Programs running inside it cannot have a permanent impact on the hard disk. It is an independent virtual environment that can be used to test untrusted applications or Internet behaviors.

[0213] A parsing execution interface is added in each security sandbox to parse the target command string. It can be known that in order to parse the target command string, a code compilation environment exists in each security sandbox, such as the node.js compilation environment of the js language, the GCC compilation environment of the C language, etc. In order to refine the interaction process, the above steps such as generating the target command string can be completed by a customized backend service interface in the backend device.

[0214] A target security sandbox is selected from multiple security sandboxes, and a customized backend service interface generates an internal sending request according to a target command string, and the internal sending request carrying the target command string is sent to the target security sandbox via TCP (Transmission Control Protocol) or HTTP (HyperText Transfer Protocol). The parsing execution interface in the target security sandbox calls the function generation object function to convert the target command string into an executable function code, that is, an executable function is generated through the function generation object function, and the function body of the executable function is created by the target command string.

[0215] After the executable function code is generated, based on the code compilation environment, the parsing execution interface in the target security sandbox can run the executable function code, that is, execute the first command, the second command and the third command respectively in the order of the first command string, the second command string, the third command string and the expression string in the executable function code.

[0216] From the description of each command above, it can be seen that after running the executable function code, the target array will be generated, and strings or variables will be added to the target array. After the run is completed, the parsing execution interface combines all array elements in the target array into a code output result, which is the parsing result obtained by the parsing execution interface after parsing the target template file in the target security sandbox.

[0217] When the back-end device obtains the normal result message sent by the target security sandbox, it receives the code output result sent by the target security sandbox, and sends the code output result to the front-end device, and the front-end device previews the code output result on the screen.

[0218] See also Figure 4 , is a flow chart of determining a target command string provided by the present sending embodiment. The specific process of determining the target command string includes steps S201 to S215:

[0219] Step S201, obtaining a target template file, and reading a content string contained in the target template file as a target content string.

[0220] Specifically, the back-end device receives the target template file to be parsed sent by the front-end device, and reads the content string contained in the target template file as the target content string. The target content string can be represented by tmpstr.

[0221] Step S202, initialize the definition code string variable and initialize the definition cursor.

[0222] Specifically, a code string variable code is defined, and a first command string "var r = []" is generated for executing a first command, where the first command is a command for creating a target array. The backend device assigns the code string variable code to the first command string, and at the same time, defines a cursor cur, and assigns the cursor cur to the position subscript of the first character in the target content string tmpstr, that is, the value 0.

[0223] Step S203, cyclically matching logical character pairs in the target content string tmpstr.

[0224] Specifically, a logical matching pattern is obtained, wherein the logical matching pattern includes a logical character pair <% %>. A logical character pair is searched in the target content string tmpstr as a matching character pair <% %>, and the matching character pair includes: a first matching character <%, and a second matching character %>. The backend device obtains the position subscript of the first matching character <% in the target content string tmpstr as the starting subscript start; obtains the position subscript of the second matching character %> in the target content string tmpstr as the ending subscript end.

[0225] Step S204: extracting a first target subsequence.

[0226] Specifically, extract the character sequence between the cursor cur and the starting subscript start from the target content string tmpstr as the first target subsequence a, and generate a third command string for executing the third command, wherein the third command is to add the first target subsequence a to the target array, and the third command string can be: r.push('a'). The backend device combines the third command string with the code string variable code, and the combined code string variable code includes: varr = []; r.push('a');

[0227] Step S205: extracting the character string to be determined.

[0228] Specifically, a character sequence between a start subscript start and an end subscript end is extracted from the target content character string tmpstr as the character string matchedstr to be determined.

[0229] Step S206, detecting whether the character string to be determined matchedstr is in the format of <%=b%>.

[0230] Specifically, the backend device detects whether the string matchedstr to be determined is in the format of <%=b%>, or whether the string matchedstr to be determined contains the target variable identifier "=". If the detection result is "yes", execute step S207; if the detection result is "no", execute step S208.

[0231] Step S207, extracting the variable character string.

[0232] Specifically, the backend device extracts the string other than the target variable identifier "=" in the to-be-determined string matchedstr as the variable string b. Generates a second command string for executing the second command, wherein the second command is to add the variable b to the target array, and the second command string is: r.push(b). The backend device combines the second command string with the code string variable code, and the combined code string variable code includes: var r = []; r.push('a'); r.push(b).

[0233] Step S208, extract the character string between <% and %> as the character string c.

[0234] Step S209, determining whether the character string c contains a logic keyword, if not, executing step S210; if containing a logic keyword, executing step S211.

[0235] Step S210, generating a second command string and updating a code string variable.

[0236] Specifically, if the logic keyword is not included, a second command string for executing the second command is generated, wherein the second command is to add a variable c to the target array, and the third command string is: r.push(c). The backend device combines the second command string with the code string variable code, and the combined code string variable code includes: var r = []; r.push('a'); r.push(c).

[0237] Step S211, extract the expression string and update the code string variable.

[0238] Specifically, if the logical keyword is included, the string c is directly determined as an expression string, and the backend device combines the expression string with the code string variable code. The combined code string variable code includes: var r = []; r.push ('a'); c. The backend device assigns the cursor cur to the end subscript end + 1.

[0239] Step S212, determine whether there is still a matching character pair <% %> in the target content string tmpstr that is not involved in the operation. If so, execute step S203 again to update the code string variable code again; if not, execute step S213.

[0240] Step S213: The characters between the cursor cur and the position subscript of the last character in the target content character string tmpstr are taken as the character string d (ie, the second target subsequence).

[0241] Step S214, generating a third command string for executing a third command, wherein the third command is to add a string d to the target array, and the third command string is: r.push('d'). The backend device combines the third command string with the code string variable code, and the combined code string variable code includes: var r=[];r.push('a');c;r.push('d'); or var r=[];r.push('a');r.push(c);r.push('d'); or var r=[];r.push('a');r.push(b);r.push('d').

[0242] Step S215, using the code string variable code as the target command string.

[0243] From the above, it can be seen that the template file can be parsed only according to the content string contained in the template file, without detecting the file type and template language of the template file. The highly general template file parsing method can parse many different types of template files; especially when there are multiple different types of template files that need to be parsed, the general template parsing method can improve the parsing efficiency of the template file; further, running the function code in an independent sandbox environment can isolate the host system and improve system security.

[0244] See also Figure 5 , is a schematic diagram of determining a code output result provided by an embodiment of the present invention. Figure 5 As shown, the specific process of determining the code output result includes the following steps S301-step S304, and steps S301-step S304 are Figure 3a A specific embodiment of step S104 in the corresponding embodiment:

[0245] Step S301: create at least one security sandbox based on the container engine and the environment image, and select a target security sandbox that meets the load balancing condition from the at least one security sandbox.

[0246] Specifically, based on the container engine Docker and the environment image, multiple security sandboxes are started in the backend device. The environment image is used to ensure that there is a code compilation environment in each security sandbox; the type of the environment image is determined by the language corresponding to the grammatical rules satisfied by the target command string; for example, if the target command string in the above-mentioned satisfies the javescript grammatical rules, the environment image here can be the environment image of js; if the target command string in the above-mentioned satisfies the C grammatical rules, the environment image here can be the environment image of the C language. When the target command string satisfies the javescript grammatical rules, the created security sandbox can be a VM2 (Virtual Machine) sandbox. The VM2 sandbox is a security sandbox improved based on the VM module of node.js, which can be used to compile and execute JS code in the V8 virtual machine environment, that is, each security sandbox is an instance of node.js, and a parsing execution interface is added to each security sandbox to parse the target command string in the code compilation environment.

[0247] Since there are multiple security sandboxes, when starting multiple security sandboxes in a Docker container, you can configure the pm2 (process manager) manager to manage multiple security sandboxes. The pm2 manager can start multiple node.js instances at the same time, and can achieve load balancing and restart the node in real time when a process error occurs.

[0248] The pm2 manager can select a security sandbox that meets the load balancing conditions from multiple security sandboxes as the target security sandbox. The security sandbox that meets the load balancing conditions means that the pm2 manager will select an idle security sandbox or a security sandbox with a small amount of tasks as the target security sandbox based on the working status of all current security sandboxes. In this way, even if high concurrency occurs (for example, there are multiple target template files that need to be parsed at the same time), computing resources and network resources can be reasonably allocated.

[0249] Step S302, generating an internal sending request, sending the internal sending request carrying the target command string to the target security sandbox, calling a function generation object in the target security sandbox, and converting the target command string into an executable function code.

[0250] Specifically, a customized backend service interface is customized in the backend device, and the generation of the target command string involved in the aforementioned steps S101 to S103 is executed by the customized backend service interface.

[0251] The customized backend service interface generates an internal sending request according to the target command string, and the internal sending request carries the target command string. The customized backend service interface sends the internal sending request carrying the target command string to the target security sandbox via TCP or HTTP. The parsing execution interface in the target security sandbox calls the function generation object function to convert the target command string into an executable function code, that is, to generate an executable function through the function generation object function, and the function body of the executable function is the target command string. Among them, the command statement for calling the function generation object can be: var function1 = new function (arg1, arg2, ..., argN, function_body), which can be interpreted as: passing the target command string as the function_body parameter to the function generation object, that is, an executable function code with a function name of function1 can be generated, wherein arg1, arg2, ..., argN are the target variables in the executable function code (that is, the target variables in the variable string in the target template file), and the generated executable function with a function name of function1 can be directly run in the target security sandbox.

[0252] Step S303: Run the first command, the second command, and the third command corresponding to the executable function code in the target security sandbox, and combine the array elements in the target array into the code output result.

[0253] Specifically, the parsing execution interface in the target security sandbox runs the executable function code, that is, runs the first command in the target security sandbox to create a target array; if the target variable in the variable string in the target template file has a corresponding input parameter (such as Figure 2a Corresponding to the input parameter 20e in the embodiment, the customized backend service interface obtains the input parameter, and similarly sends the input parameter to the target security sandbox through an internal send request. In the target security sandbox, the parsing execution interface runs the second command to generate a result variable value corresponding to the input parameter and the target variable, and adds the result variable value as an array element to the target array.

[0254] For example, the second command string corresponding to the target variable c in the variable string is: c=a+b, and the input parameters corresponding to the target variable c are a=1, b=1; by running the second command corresponding to the second command string, c=2 can be obtained, and the value 2 is added as an array element to the target array.

[0255] The following explains how to obtain input parameters: users can manually input input variable values ​​corresponding to target variables into the back-end device, and the back-end device uses the above input variable values ​​as input parameters; or the back-end device automatically generates interface variable values ​​based on user operation behaviors in the target user interface, and the back-end device also uses the above interface variable values ​​as input parameters.

[0256] In the target security sandbox, the parsing execution interface runs a third command to add the second character sequence as an array element to the target array. The parsing execution interface adds all array elements (such as Figure 5 The array elements 1, array element 2, array element 3, etc. in the target array are combined into the code output result. It can be that when the executable function code is finished running, the parsing execution interface combines all the array elements in the target array into the code output result; or it can be that during the running of the executable function code, as long as the array elements are added to the target array, they are combined until the executable function code is finished running, and the final combination result is used as the code output result.

[0257] Step S304, when a normal result message fed back by the target security sandbox is obtained, the code output result sent by the target security sandbox is received, and the code output result is forwarded to the front-end device so that the front-end device displays the code output result.

[0258] Specifically, the parsing execution interface continuously monitors whether there are malicious lines in the executable function code during the execution of the executable function code. For example, deleting system files, maliciously consuming memory, and continuously adding array elements to the target array are all malicious behaviors.

[0259] If the parsing execution interface detects that there is no malicious behavior in the executable function code, when the executable function code is finished running, the parsing execution interface in the target security sandbox generates a normal result message and feeds the normal result message back to the customized backend service interface. At the same time, the parsing execution interface also sends the code output result obtained after parsing to the customized backend service interface. After receiving the normal result message, the customized backend service interface can receive the code output result sent by the parsing execution interface, and the customized backend service interface then forwards the code output result to the front-end device so that the front-end device displays the code output result.

[0260] If the parsing execution interface detects malicious behavior in the executable function code, the parsing execution interface in the target security sandbox generates an exception result message and feeds back the exception result message to the customized backend service interface; at the same time, the parsing execution interface stops running the executable function code and notifies the pm2 manager to close the process corresponding to the target security sandbox. After receiving the exception result message, the customized backend service interface generates an exception prompt message and forwards the exception prompt message to the front-end device. For example, the exception prompt message can be: There is malicious behavior in your template file, please check!

[0261] Please also see Figure 6 , is a schematic diagram of an interactive data processing provided by an embodiment of the present invention. Figure 6 As shown, the front-end device sends the target template file to be parsed to the back-end device, and the customized back-end service interface in the back-end device generates a target command string according to the target template file, wherein the specific process of generating the target command string can be parameterized as described above. Figure 4 Steps S201 to S215 in the embodiment.

[0262] The customized backend service interface can further obtain the input parameters corresponding to the target variables in the target command string, where the input parameters can be the input variable values ​​manually entered by the user, or the interface variable values, where the user's operation behavior in the target user interface will trigger the backend device to automatically generate the interface variable values. Based on the container engine docker and the js environment image, multiple VM2 sandboxes (that is, the security sandbox mentioned above) are started, and each VM2 sandbox is also a Node.js instance.

[0263] A parsing execution interface for parsing the target command string is set in each VM2 sandbox, and a pm2 manager is configured for multiple VM2 sandboxes. The pm2 manager selects a target security sandbox from multiple VM2 sandboxes. The customized backend service interface passes the target command string and input parameters to the target security sandbox. The parsing execution interface in the target security sandbox converts the target command string into an executable function code and runs the executable function code in the target security sandbox.

[0264] After the run is completed, the array elements in the generated target array are combined into the code output result. The handler in the customized backend service interface receives the code output result sent by the target security sandbox and forwards the code output result to the front-end device, which can display the code output result to the user. The specific process of parsing the target command string can be seen above. Figure 5 This corresponds to step S301 to step S304 in the embodiment.

[0265] From the above, it can be seen that the template file can be parsed only according to the content string contained in the template file, without detecting the file type and template language of the template file. The highly general template file parsing method can parse many different types of template files; especially when there are multiple different types of template files that need to be parsed, the general template parsing method can improve the parsing efficiency of the template file; further, running the function code in an independent sandbox environment can isolate the host system and improve system security.

[0266] For further information, see Figure 7 , is a schematic diagram of the structure of a data processing device provided by an embodiment of the present invention. Figure 7 As shown, the data processing device 1 can be applied to the above Figure 3a-Figure 6 Corresponding to the backend device in the embodiment, the data processing device 1 may include: an acquisition module 11, a division module 12, an extraction module 13, a generation module 14, and an operation module 15.

[0267] An acquisition module 11 is used to acquire a target template file sent by a front-end device;

[0268] A division module 12, used for dividing the target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type;

[0269] An extraction module 13, used for extracting a logical string from the first character sequence;

[0270] A generating module 14, configured to generate a target command string for executing a command according to the logic string and the second character sequence;

[0271] The running module 15 is used to generate an executable function code in the target security sandbox according to the target command string, and obtain a code output result matching the target template file by running the executable function code in the target security sandbox, and send the code output result to the front-end device so that the front-end device displays the code output result.

[0272] The specific functional implementation of the acquisition module 11, the division module 12, the extraction module 13, the generation module 14, and the operation module 15 can be referred to above. Figure 3a Steps S101 to S104 in the corresponding embodiment will not be described in detail here.

[0273] See also Figure 7 , the logical string includes expression string and variable string;

[0274] The generating module 14 may include: a generating unit 141 and a combining unit 142 .

[0275] A generating unit 141 is used to generate a first command string for executing a first command, where the first command is a command for creating a target array;

[0276] The generating unit 141 is further configured to generate a second command string for executing a second command according to the variable string, wherein the second command is a command for adding a variable to the target array;

[0277] The generating unit 141 is further configured to generate a third command string for executing a third command according to the second character sequence, wherein the third command is a command for adding the second character sequence to the target array;

[0278] The combining unit 142 is used to combine the first command string, the second command string, the third command string and the expression string into the target command string according to the position information of the variable string, the second character sequence and the expression string in the target content string.

[0279] The specific functional implementation of the generating unit 141 and the combining unit 142 can be found in the above Figure 3a The step S103 in the corresponding embodiment will not be described in detail here.

[0280] See also Figure 7 The operation module 15 may include: a selection unit 151, a conversion unit 152, an operation unit 153, and a receiving unit 154.

[0281] A selection unit 151 is used to create at least one security sandbox based on the container engine and the environment image, and select a target security sandbox that meets the load balancing condition from the at least one security sandbox;

[0282] The conversion unit 152 is used to generate an internal sending request, send the internal sending request carrying the target command string to the target security sandbox, call a function to generate an object in the target security sandbox, and convert the target command string into an executable function code;

[0283] An execution unit 153 is used to execute the first command, the second command and the third command corresponding to the executable function code in the target security sandbox, and combine the array elements in the target array into the code output result;

[0284] The receiving unit 154 is used to receive the code output result sent by the target security sandbox when a normal result message fed back by the target security sandbox is obtained, and forward the code output result to the front-end device so that the front-end device displays the code output result.

[0285] The specific functional implementation of the selection unit 151, the conversion unit 152, the operation unit 153, and the receiving unit 154 can be found in the above Figure 5 Steps S301 to S304 in the corresponding embodiment are not described in detail here.

[0286] See also Figure 7 The operation module 15 may include: a selection unit 151 , a conversion unit 152 , an operation unit 153 , a receiving unit 154 , and may also include: a stop unit 155 .

[0287] The stopping unit 155 is used to stop running the executable function code and close the process corresponding to the target security sandbox when obtaining the abnormal result message fed back by the target security sandbox, generate an abnormal prompt message, and forward the abnormal prompt message to the front-end device.

[0288] The specific function implementation of the stop unit 155 can be found in the above Figure 5 The step S304 in the corresponding embodiment will not be described in detail here.

[0289] See also Figure 7 The running unit 153 may include: a running subunit 1531 and an acquiring subunit 1532 .

[0290] An execution subunit 1531 is configured to execute the first command in the target security sandbox to create the target array;

[0291] An acquisition subunit 1532 is used to acquire an input parameter corresponding to the target variable in the variable string;

[0292] The running subunit 1531 is further configured to send the input parameter to the target security sandbox according to the internal sending request;

[0293] The execution subunit 1531 is further configured to execute the second command in the target security sandbox to generate a result variable value corresponding to the input parameter and the target variable, and add the result variable value as an array element to the target array;

[0294] The execution subunit 1531 is further configured to execute the third command in the target security sandbox to add the second character sequence as an array element to the target array;

[0295] The running subunit 1531 is further used to combine all array elements in the target array into the code output result.

[0296] The specific functional implementation of the operation subunit 1531 and the acquisition subunit 1532 can be found in the above Figure 5 The step S303 in the corresponding embodiment will not be described in detail here.

[0297] See also Figure 7 The acquisition subunit 1532 may include: a receiving subunit 15321 and a generating subunit 15322.

[0298] The receiving subunit 15321 is used to receive an input variable value corresponding to the target variable in the variable string, and determine the input variable value as the input parameter; or,

[0299] The generating subunit 15322 is used to generate an interface variable value according to the target user interface, and determine the interface variable value as the input parameter; the interface variable value is generated according to the user's operation behavior in the target user interface.

[0300] The specific functional implementation of the receiving subunit 15321 and the generating subunit 15322 can be found in the above Figure 5 The step S303 in the corresponding embodiment will not be described in detail here.

[0301] See also Figure 7 The division module 12 may include: a reading unit 121, a matching unit 122, and a first determination unit 123.

[0302] The reading unit 121 is used to read a plurality of content characters contained in the target template file as the target content character string;

[0303] The reading unit 121 is further used to obtain a logical matching pattern; the logical matching pattern includes a logical character pair;

[0304] A matching unit 122, configured to determine a matching character pair in the target content string that satisfies a regular matching rule with the logical character pair; the matching character pair includes a first matching character and a second matching character;

[0305] The matching unit 122 is further configured to extract a character sequence from the target content character string using the first matching character as a starting point of the character sequence and the second matching character as an end point of the character sequence as the first character sequence;

[0306] The first determining unit 123 is configured to use a character sequence other than the first character sequence in the target content character string as the second character sequence.

[0307] The specific functional implementation of the reading unit 121, the matching unit 122, and the first determination unit 123 can be referred to above. Figure 3a The step S101 in the corresponding embodiment will not be described in detail here.

[0308] See also Figure 7 The first determining unit 123 may include: a first determining subunit 1231 and a second determining subunit 1232.

[0309] The first determining subunit 1231 is used to obtain the first position subscript of the first matching character in the target content string as the starting subscript, and obtain the first position subscript of the second matching character in the target content string as the ending subscript;

[0310] The first determining subunit 1231 is further used to obtain the position subscript of the first character in the target content string as a cursor;

[0311] The first determining sub-unit 1231 is further configured to use a character sequence in the interval between the cursor and the start subscript as a first target sub-sequence;

[0312] The first determining sub-unit 1231 is further configured to determine the position subscript adjacent to the end subscript as the cursor, determine the next start subscript according to the first matching character, and determine the next end subscript according to the second matching character, until all first target subsequences in the target content string are determined;

[0313] The first determining subunit 1231 is further configured to use a character sequence in a position subscript interval between the cursor and the last character in the target content string as a second target subsequence;

[0314] The second determining subunit 1232 is configured to determine all first target subsequences and the second target subsequences as the second character sequence.

[0315] The specific functional implementation of the first determining subunit 1231 and the second determining subunit 1232 can refer to the above Figure 4 The step S204 in the corresponding embodiment will not be described in detail here.

[0316] See also Figure 7 , the logical string includes expression string and variable string;

[0317] The extraction module 13 may include: a second determination unit 131 and a third determination unit 132 .

[0318] A second determining unit 131 is used to take the character string between the matching character pairs in the first character sequence as a character string to be determined;

[0319] The second determining unit 131 is further configured to determine the to-be-determined string as the expression string if the to-be-determined string contains a logical keyword;

[0320] The third determining unit 132 is configured to determine the character string other than the target variable identifier in the character string to be determined as the variable character string if the character string to be determined includes a target variable identifier.

[0321] The specific functional implementation of the second determining unit 131 and the third determining unit 132 can refer to the above Figure 4 Steps S204 to S211 in the corresponding embodiment are not described in detail here.

[0322] See also Figure 7 The acquisition module 11 may include: an acquisition unit 111 and a fourth determination unit 112.

[0323] An acquisition unit 111 is used to acquire the original template file sent by the front-end device;

[0324] The acquisition unit 111 is further used to extract the template variable identifier corresponding to the variable in the original template file, and extract the template expression identifier corresponding to the expression in the original template file;

[0325] The fourth determining unit 112 is configured to determine the original template file as the target template file if the template variable identifier and the template expression identifier are both the same as the logical character pair.

[0326] The specific functional implementation of the acquisition unit 111 and the fourth determination unit 112 can be found in the above Figure 3a The step S101 in the corresponding embodiment will not be described in detail here.

[0327] For further information, see Figure 8 , is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3a-Figure 6 The back-end device in the corresponding embodiment may be an electronic device 1000, such as Figure 8As shown, the electronic device 1000 may include: a user interface 1002, a processor 1004, an encoder 1006 and a memory 1008. The signal receiver 1016 is used to receive or send data via a cellular interface 1010, a WIFI interface 1012, ..., or an NFC interface 1014. The encoder 1006 encodes the received data into a data format for computer processing. A computer program is stored in the memory 1008, and the processor 1004 is configured to perform the steps in any of the above method embodiments through the computer program. The memory 1008 may include a volatile memory (e.g., a dynamic random access memory DRAM), and may also include a non-volatile memory (e.g., a one-time programmable read-only memory OTPROM). In some instances, the memory 1008 may further include a memory remotely arranged relative to the processor 1004, and these remote memories may be connected to the electronic device 1000 via a network. The user interface 1002 may include: a keyboard 1018 and a display 1020.

[0328] exist Figure 8 In the electronic device 1000 shown, the processor 1004 may be used to call a computer program stored in the memory 1008 to implement:

[0329] Acquire a target template file sent by a front-end device, and divide a target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type;

[0330] Extracting a logical string from the first character sequence, and generating a target command string for executing a command according to the logical string and the second character sequence;

[0331] Generate an executable function code in the target security sandbox according to the target command string, obtain a code output result matching the target template file by running the executable function code in the target security sandbox, and send the code output result to the front-end device so that the front-end device displays the code output result.

[0332] In one embodiment, the logic string includes an expression string and a variable string;

[0333] When the processor 1004 generates a target command string for executing a command according to the logic string and the second character sequence, the processor 1004 specifically performs the following steps:

[0334] Generate a first command string for executing a first command, wherein the first command is a command for creating a target array;

[0335] generating a second command string for executing a second command according to the variable string, wherein the second command is a command for adding a variable to the target array;

[0336] Generate a third command string for executing a third command according to the second character sequence, wherein the third command is a command for adding the second character sequence to the target array;

[0337] The first command string, the second command string, the third command string and the expression string are combined into the target command string according to the position information of the variable string, the second character sequence and the expression string in the target content string.

[0338] In one embodiment, the processor 1004 generates an executable function code according to the target command string in the target security sandbox, obtains a code output result matching the target template file by running the executable function code in the target security sandbox, and sends the code output result to the front-end device so that the front-end device displays the code output result, and specifically performs the following steps:

[0339] Create at least one security sandbox based on the container engine and the environment image, and select a target security sandbox that meets the load balancing condition from the at least one security sandbox;

[0340] Generate an internal sending request, send the internal sending request carrying the target command string to the target security sandbox, call a function to generate an object in the target security sandbox, and convert the target command string into an executable function code;

[0341] Running the first command, the second command, and the third command corresponding to the executable function code in the target security sandbox, and combining array elements in the target array into the code output result;

[0342] When a normal result message fed back by the target security sandbox is obtained, the code output result sent by the target security sandbox is received, and the code output result is forwarded to the front-end device, so that the front-end device displays the code output result.

[0343] In one embodiment, the processor 1004 further performs the following steps:

[0344] When the abnormal result message fed back by the target security sandbox is obtained, the execution of the executable function code is stopped, and the process corresponding to the target security sandbox is closed, an abnormal prompt message is generated, and the abnormal prompt message is forwarded to the front-end device.

[0345] In one embodiment, when the processor 1004 executes the first command, the second command, and the third command corresponding to the executable function code in the target security sandbox and combines the array elements in the target array into the code output result, the processor 1004 specifically performs the following steps:

[0346] Running the first command in the target security sandbox to create the target array;

[0347] Acquire an input parameter corresponding to a target variable in the variable string, and send the input parameter to the target security sandbox according to the internal sending request;

[0348] Running the second command in the target security sandbox to generate a result variable value corresponding to the input parameter and the target variable, and adding the result variable value as an array element to the target array;

[0349] Running the third command in the target security sandbox to add the second character sequence as an array element to the target array;

[0350] All array elements in the target array are combined into the code output result.

[0351] In one embodiment, when the processor 1004 executes the acquisition of the input parameter corresponding to the target variable in the variable string, the processor 1004 specifically performs the following steps:

[0352] receiving an input variable value corresponding to the target variable in the variable string, and determining the input variable value as the input parameter; or,

[0353] An interface variable value is generated according to a target user interface, and the interface variable value is determined as the input parameter; the interface variable value is generated according to the user's operation behavior in the target user interface.

[0354] In one embodiment, when the processor 1004 divides the target content string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type, the processor 1004 specifically performs the following steps:

[0355] Reading a plurality of content characters contained in the target template file as the target content character string;

[0356] Obtaining a logical matching pattern; the logical matching pattern includes a logical character pair;

[0357] Determine in the target content character string a matching character pair that satisfies a regular matching rule with the logical character pair; the matching character pair includes a first matching character and a second matching character;

[0358] Taking the first matching character as the starting point of the character sequence and the second matching character as the ending point of the character sequence, extracting a character sequence from the target content character string as the first character sequence;

[0359] The character sequence in the target content character string except the first character sequence is used as the second character sequence.

[0360] In one embodiment, when the processor 1004 uses the character sequence other than the first character sequence in the target content character string as the second character sequence, the processor 1004 specifically performs the following steps:

[0361] Obtaining the first position subscript of the first matching character in the target content string as the starting subscript, and obtaining the first position subscript of the second matching character in the target content string as the ending subscript;

[0362] Obtain the position subscript of the first character in the target content string as a cursor;

[0363] Taking the character sequence between the cursor and the starting subscript as the first target subsequence;

[0364] Determine the position subscript adjacent to the end subscript as the cursor, determine the next start subscript according to the first matching character, and determine the next end subscript according to the second matching character, until all first target subsequences in the target content character string are determined;

[0365] Taking a character sequence in the position subscript interval between the cursor and the last character in the target content character string as a second target subsequence;

[0366] All first target subsequences and the second target subsequences are determined as the second character sequence.

[0367] In one embodiment, the logic string includes an expression string and a variable string;

[0368] When the processor 1004 extracts a logical string from the first character sequence, the processor 1004 specifically performs the following steps:

[0369] taking the character string between the matching character pairs in the first character sequence as the character string to be determined;

[0370] If the character string to be determined contains a logical keyword, the character string to be determined is determined as the expression character string;

[0371] If the character string to be determined includes a target variable identifier, the character string in the character string to be determined except for the target variable identifier is determined as the variable character string.

[0372] In one embodiment, when the processor 1004 executes the acquisition of the target template file sent by the front-end device, the processor 1004 specifically performs the following steps:

[0373] Obtaining the original template file sent by the front-end device;

[0374] Extracting a template variable identifier corresponding to a variable in the original template file, and extracting a template expression identifier corresponding to an expression in the original template file;

[0375] If the template variable identifier and the template expression identifier are both the same as the logical character pair, the original template file is determined as the target template file.

[0376] It should be understood that the electronic device 1000 described in the embodiment of the present invention can execute the above Figures 3a to 6 The description of the data processing method in the corresponding embodiment can also be performed as described above. Figure 7 The description of the data processing device 1 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here either.

[0377] In addition, it should be pointed out that: an embodiment of the present invention further provides a computer storage medium, and the computer storage medium stores a computer program executed by the data processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the above-mentioned Figures 3a to 6 The description of the data processing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer storage medium embodiment of the present invention, please refer to the description of the method embodiment of the present invention.

[0378] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0379] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A data processing method, It is characterized in that include: Acquire a target template file sent by a front-end device, and divide a target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type; Extracting a logical string from the first character sequence, and generating a target command string for executing a command according to the logical string and the second character sequence; Create at least one security sandbox based on the container engine and the environment image, and select a target security sandbox that meets the load balancing condition from the at least one security sandbox; Generate an internal sending request, send the internal sending request carrying the target command string to the target security sandbox, call a function to generate an object in the target security sandbox, and convert the target command string into an executable function code; Running a first command, a second command, and a third command corresponding to the executable function code in the target security sandbox, and combining array elements in a target array into a code output result; the first command is a command for creating the target array, the second command is a command for adding a variable to the target array, and the third command is a command for adding the second character sequence to the target array; When a normal result message fed back by the target security sandbox is obtained, the code output result sent by the target security sandbox is received, and the code output result is forwarded to the front-end device, so that the front-end device displays the code output result.

2. The method according to claim 1, It is characterized in that The logic string includes an expression string and a variable string; The step of generating a target command string for executing a command according to the logic string and the second character sequence comprises: Generate a first command string for executing a first command, wherein the first command is a command for creating a target array; generating a second command string for executing a second command according to the variable string, wherein the second command is a command for adding a variable to the target array; Generate a third command string for executing a third command according to the second character sequence, wherein the third command is a command for adding the second character sequence to the target array; The first command string, the second command string, the third command string and the expression string are combined into the target command string according to the position information of the variable string, the second character sequence and the expression string in the target content string.

3. The method according to claim 1, It is characterized in that Also includes: When the abnormal result message fed back by the target security sandbox is obtained, the execution of the executable function code is stopped, and the process corresponding to the target security sandbox is closed, an abnormal prompt message is generated, and the abnormal prompt message is forwarded to the front-end device.

4. The method according to claim 2, It is characterized in that The step of running the first command, the second command, and the third command corresponding to the executable function code in the target security sandbox, and combining array elements in the target array into a code output result, comprises: Running the first command in the target security sandbox to create the target array; Acquire an input parameter corresponding to a target variable in the variable string, and send the input parameter to the target security sandbox according to the internal sending request; Running the second command in the target security sandbox to generate a result variable value corresponding to the input parameter and the target variable, and adding the result variable value as an array element to the target array; Running the third command in the target security sandbox to add the second character sequence as an array element to the target array; All array elements in the target array are combined into the code output result.

5. The method according to claim 4, It is characterized in that The step of obtaining the input parameter corresponding to the target variable in the variable character string includes: receiving an input variable value corresponding to the target variable in the variable string, and determining the input variable value as the input parameter; or, An interface variable value is generated according to a target user interface, and the interface variable value is determined as the input parameter; the interface variable value is generated according to the user's operation behavior in the target user interface.

6. The method according to claim 1, It is characterized in that The step of dividing the target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type includes: Reading a plurality of content characters contained in the target template file as the target content character string; Obtaining a logical matching pattern; the logical matching pattern includes a logical character pair; Determine in the target content character string a matching character pair that satisfies a regular matching rule with the logical character pair; the matching character pair includes a first matching character and a second matching character; Taking the first matching character as the starting point of the character sequence and the second matching character as the ending point of the character sequence, extracting a character sequence from the target content character string as the first character sequence; The character sequence in the target content character string except the first character sequence is used as the second character sequence.

7. The method according to claim 6, It is characterized in that The step of taking a character sequence other than the first character sequence in the target content character string as the second character sequence includes: Obtaining the first position subscript of the first matching character in the target content string as the starting subscript, and obtaining the first position subscript of the second matching character in the target content string as the ending subscript; Obtain the position subscript of the first character in the target content string as a cursor; Taking the character sequence between the cursor and the starting subscript as the first target subsequence; Determine the position subscript adjacent to the end subscript as the cursor, determine the next start subscript according to the first matching character, and determine the next end subscript according to the second matching character, until all first target subsequences in the target content character string are determined; Taking a character sequence in the position subscript interval between the cursor and the last character in the target content character string as a second target subsequence; All first target subsequences and the second target subsequences are determined as the second character sequence.

8. The method according to claim 6, It is characterized in that The logic string includes an expression string and a variable string; The step of extracting a logical string from the first character sequence comprises: taking the character string between the matching character pairs in the first character sequence as the character string to be determined; If the character string to be determined contains a logical keyword, the character string to be determined is determined as the expression character string; If the character string to be determined includes a target variable identifier, the character string in the character string to be determined except for the target variable identifier is determined as the variable character string.

9. The method according to claim 6, It is characterized in that The step of obtaining the target template file sent by the front-end device includes: Obtaining the original template file sent by the front-end device; Extracting a template variable identifier corresponding to a variable in the original template file, and extracting a template expression identifier corresponding to an expression in the original template file; If the template variable identifier and the template expression identifier are both the same as the logical character pair, the original template file is determined as the target template file.

10. A data processing device, It is characterized in that include: An acquisition module is used to acquire the target template file sent by the front-end device; A division module, used for dividing the target content character string contained in the target template file into a first character sequence belonging to a logical operation type and a second character sequence belonging to a general character type; An extraction module, used for extracting a logical string from the first character sequence; A generating module, used for generating a target command string for executing a command according to the logic string and the second character sequence; An operation module is used to generate an executable function code according to the target command string in a target security sandbox, obtain a code output result matching the target template file by running the executable function code in the target security sandbox, and send the code output result to the front-end device so that the front-end device displays the code output result; Wherein, the operation module includes: A selection unit, configured to create at least one security sandbox based on the container engine and the environment image, and select a target security sandbox that meets the load balancing condition from the at least one security sandbox; A conversion unit, configured to generate an internal sending request, send the internal sending request carrying the target command string to the target security sandbox, call a function to generate an object in the target security sandbox, and convert the target command string into an executable function code; an execution unit, configured to execute a first command, a second command, and a third command corresponding to the executable function code in the target security sandbox, and combine array elements in a target array into a code output result; the first command is a command for creating the target array, the second command is a command for adding a variable to the target array, and the third command is a command for adding the second character sequence to the target array; The receiving unit is used to receive the code output result sent by the target security sandbox when a normal result message fed back by the target security sandbox is obtained, and forward the code output result to the front-end device so that the front-end device displays the code output result.

11. The device according to claim 10, It is characterized in that The logic string includes an expression string and a variable string; The generating module comprises: A generating unit, configured to generate a first command string for executing a first command, wherein the first command is a command for creating a target array; The generating unit is further used to generate a second command string for executing a second command according to the variable string, wherein the second command is a command for adding a variable to the target array; The generating unit is further used to generate a third command string for executing a third command according to the second character sequence, wherein the third command is a command for adding the second character sequence to the target array; A combining unit is used to combine the first command string, the second command string, the third command string and the expression string into the target command string according to the position information of the variable string, the second character sequence and the expression string in the target content string.

12. An electronic device, It is characterized in that include: Processor and memory; The processor is connected to a memory, wherein the memory is used to store program codes, and the processor is used to call the program codes to execute the method according to any one of claims 1-9.

13. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 9 is executed.