Method, device, electronic device and storage medium for generating regular expressions
By generating a selection list in the rule editing area and displaying conditional configuration items of preset graphics, the problem of low efficiency in generating rule expressions in the existing technology is solved, and more efficient rule expression generation and understanding are achieved.
Patent Information
- Application Number
- CN202210658977.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-09
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-06-09
AI Technical Summary
In the prior art, generating regular expressions requires users to be very familiar with regular expressions, and each time an expression is created, it needs to be manually constructed, resulting in low processing efficiency, especially when the logical rules are complex, which takes a long time.
By generating a selection list through input operations in the rule editing area, the rule composition symbols and condition configuration items that match the input content are displayed, and the condition configuration items with preset graphics are displayed in the rule editing area, thereby enhancing visual relevance and reducing user understanding costs.
Improves the efficiency of generating rule expressions, reduces user input errors, strengthens the association between the rule editing area and the condition configuration area, and makes it easier for users to understand the meaning of rule expressions.
Smart Images

Figure CN115080022B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, electronic device, and storage medium for generating a regular expression. Background Art
[0002] Currently, a common rule editor is usually used to manually input rule editing commands through a keyboard to generate corresponding rules, and the generated rules are used to process data.
[0003] However, this rule-based approach requires users to be very familiar with the corresponding regular expressions, and each time an expression is created, it must be manually rebuilt. Even if a previously established expression is used, it must be manually adjusted to the new expression. During this expression-building process, when the expression contains many characters, the logical rules of the expression can become quite complex. Whether creating a new expression or rewriting an existing one, this process can be time-consuming and inefficient. Summary of the Invention
[0004] In view of this, the purpose of the present disclosure is to provide a method, device, electronic device and storage medium for generating a regular expression.
[0005] Based on the above objectives, the present disclosure provides a method for generating a regular expression, comprising:
[0006] In response to an input operation on a rule editing area, generating a selection list based on the input content, and displaying rule component symbols and / or condition configuration items matching the input content in the selection list;
[0007] In response to an input completion operation on the rule editing area, displaying the rule composition symbol and / or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression;
[0008] The conditional configuration items in the selection list are obtained based on preset configuration conditions, and the preset graphic of the conditional configuration items displayed in the rule editing area is the same as the graphic of the configuration conditions.
[0009] Optionally, in response to an input operation on the rule editing area, generating a selection list based on the input content includes:
[0010] A focus event of the rule editing area is acquired, position information of a cursor in the rule editing area is determined, and the selection list is generated based on the position information.
[0011] Optionally, displaying the rule components and / or condition configuration items matching the input content in the selection list includes:
[0012] In response to the input content including the conditional configuration item, displaying the conditional configuration item with a preset graphic in the selection list;
[0013] In response to the input content including at least some characters of the regular component, all the regular components including the at least some characters are displayed in the selection list.
[0014] Optionally, displaying the rule components and / or condition configuration items matching the input content in the selection list further includes:
[0015] In response to the input content being empty, all the condition configuration items and all the rule composition symbols having preset graphics are displayed in the selection list.
[0016] Optionally, also include:
[0017] Marking one of the condition configuration items or the rule component in the selection list in a first marking state;
[0018] In response to a selection operation on the condition configuration item or the rule component in the first marking state, the rule component and / or the condition configuration item with a preset graphic is displayed in the rule editing area.
[0019] Optionally, also include:
[0020] Verify the regular expression based on preset verification rules to obtain a verification result;
[0021] In response to a check result of the rule expression being wrong, marking the wrong condition configuration item and / or the rule component in the rule expression in a second marking state.
[0022] The present disclosure also provides a device for generating a regular expression, comprising:
[0023] a generating module configured to: in response to an input operation on the rule editing area, generate a selection list based on the input content, and display rule components and / or condition configuration items matching the input content in the selection list;
[0024] A display module is configured to: in response to an input completion operation on the rule editing area, display the rule composition symbol and / or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression;
[0025] The conditional configuration items in the selection list are obtained based on preset configuration conditions, and the preset graphic of the conditional configuration items displayed in the rule editing area is the same as the graphic of the configuration conditions.
[0026] Optionally, the generating module is further configured to:
[0027] In response to the input content including the conditional configuration item, displaying the conditional configuration item with a preset graphic in the selection list;
[0028] In response to the input content including at least some characters of the regular component, all the regular components including the at least some characters are displayed in the selection list.
[0029] The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the above methods when executing the program.
[0030] The present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute any of the above methods.
[0031] As can be seen from the above, the method, device, electronic device and storage medium for generating rule expressions provided by the present disclosure, when entering conditional rules in the rule editing area of the conditional editor, will generate a selection list based on the input content, and the selection list only displays rule components and / or condition configuration items that match the input content, and the rule components and condition configuration items are both preset content, thereby avoiding the user from mistakenly entering other non-existent information when entering rule components and / or condition configuration items; after the input is completed, the rule components and / or condition configuration items are displayed in the rule editing area, and the condition configuration items displayed in the rule editing area have preset graphics that are the same as the preset configuration conditions, so that the visual styles of the condition configuration items in the rule editing area and the condition configuration area are unified, and the association relationship between the two parts is enhanced, thereby making it easier for users to understand the meaning of the rule expression and reducing the user's understanding cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0033] Figure 1 A schematic diagram of conditional editing of a conditional editor in the related art;
[0034] Figure 2 A flowchart of a method for generating a regular expression according to an embodiment of the present disclosure;
[0035] Figure 3 This is a first schematic diagram of rule editing according to an embodiment of the present disclosure;
[0036] Figure 4 A second schematic diagram of rule editing according to an embodiment of the present disclosure;
[0037] Figure 5 A third schematic diagram of rule editing according to an embodiment of the present disclosure;
[0038] Figure 6a This is a first schematic diagram of the regular expression verification result according to the embodiment of the present disclosure;
[0039] Figure 6b A second schematic diagram of the regular expression verification result according to an embodiment of the present disclosure;
[0040] Figure 6c A third schematic diagram of the regular expression verification result according to an embodiment of the present disclosure;
[0041] Figure 6d This is a fourth schematic diagram of the regular expression verification result according to the embodiment of the present disclosure;
[0042] Figure 7 A schematic diagram of the structure of the apparatus for generating regular expressions according to an embodiment of the present disclosure;
[0043] Figure 8 Schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0044] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0045] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should have the usual meanings understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative position relationships. When the absolute position of the described object changes, the relative position relationship may also change accordingly.
[0046] As described in the background technology, Figure 1 As shown, in the conditional editor in the prior art, when customizing complex logic, it is first necessary to generate multiple configuration conditions by adding conditions in the condition configuration area 200, and then directly enter the numerical serial number of the configuration condition and the preset operator in the rule editing area 100 to define the rules between each condition configuration item, thereby realizing the definition of complex logic rules.
[0047] However, since the numerical numbers used to represent configuration conditions and the operators used to represent the rules between configuration conditions operate independently and have no visually similar elements, the connection between the two parts is weak, requiring users to have a certain level of understanding and learning cost, and they cannot be used directly, making it easy for users to make mistakes. At the same time, this method of directly entering conditional configuration items and operators is similar to writing code, resulting in a high learning cost.
[0048] In view of this, the embodiment of the present disclosure provides a method for generating regular expressions to solve the above technical problems. Figure 2 As shown, the method includes:
[0049] Step S101 : In response to an input operation on a rule editing area, a selection list is generated based on the input content, and rule components and / or condition configuration items matching the input content are displayed in the selection list.
[0050] like Figure 2 As shown, the display page of the condition editor includes a condition configuration area 200 and a rule editing area 100. Before editing a rule in the rule editing area 100, you can first create multiple configuration conditions in the condition configuration area 200. Among them, the configuration conditions can include multiple attribute information such as left value, operator, specified value, right value, etc., and the content of a configuration condition is defined by multiple attribute information.
[0051] In this embodiment, the rule editing area 100 may be an input box. When text is input in the rule editing area 100 to generate input content, a selection list 110 may be generated based on the input content, and the selection list 110 may display rule components and / or condition configuration items that match the input content.
[0052] In some embodiments, rule components may include brackets, logical operators, arithmetic operators, relational operators, and / or function processing names. Logical operators may include, but are not limited to, and (logical AND), or (logical OR), xor (logical exclusive OR), not (logical negation), etc.; arithmetic operators may include, but are not limited to, + (addition operation), - (subtraction operation), * (multiplication operation), / (division operation), % (remainder operation), ! (factorial operation), etc.; relational operators may include, but are not limited to, > (greater than), < (less than), = (equal to), ≤ (less than or equal to), ≥ (greater than or equal to), ≠ (not equal to), etc.
[0053] In some embodiments, a conditional configuration item is used to represent a pre-set configuration condition. Different configuration conditions have different conditional configuration items, and the conditional configuration item can be used to represent the configuration condition. In some embodiments, the conditional configuration item can be the conditional serial number of each configuration condition. The conditional serial number can be a numerical serial number, such as 1, 2, 3...; or, the conditional serial number can be an alphabetical serial number, such as a, b, c...; or, the conditional serial number can also be a serial number in any other form, which is not limited in this embodiment. When business processing is performed based on a regular expression containing a conditional configuration item, the content of the configuration condition corresponding to the conditional configuration item can be called to implement the business processing.
[0054] In this embodiment, the conditional configuration items displayed in the selection list 110 are obtained based on the configuration conditions pre-set in the conditional configuration area 200. For example, when three configuration conditions are set in the conditional configuration area 200, the selection list 110 only displays the three conditional configuration items corresponding to these three configuration conditions, and does not display the conditional configuration items corresponding to the configuration conditions not set in the conditional configuration area 200. Accordingly, the rule composers displayed in the selection list 110 are also pre-set rule composers, and rule composers that are not allowed to be input in the rule editing area 100 are not displayed.
[0055] Step S103, in response to the input completion operation for the rule editing area, the rule composition symbol and / or the condition configuration item with a preset graphic is displayed in the rule editing area to generate a rule expression; wherein, the condition configuration item in the selection list is obtained based on a preset configuration condition, and the preset graphic of the condition configuration item displayed in the rule editing area is the same as the graphic of the configuration condition.
[0056] In this embodiment, when the input of the rule component and / or the condition configuration item is completed, the rule component and / or the condition configuration item with the preset graphic can be displayed in the rule editing area 100, thereby generating a regular expression formed by the condition configuration item and the rule component. Among them, the preset graphic can be a circle, a rectangle, a triangle, a regular polygon, etc., and this embodiment does not limit this. Taking the circle as an example, when the condition configuration item is the condition sequence number 1, 2, 3..., the condition configuration item with the preset graphic is ①, ②, ③...; when the condition configuration item is the condition sequence number a, b, c..., the condition configuration item with the preset graphic is
[0057] In this embodiment, the preset graphic of the condition configuration item displayed in the rule editing area 100 is the same as the graphic of the configuration condition in the condition configuration area 200. Figure 3 As shown, the graphics of each configuration condition in the condition configuration area 200 are circular, and the condition configuration items with preset graphics displayed in the rule editing area 100 are also circular.
[0058] Optionally, in this embodiment, the conditional configuration item with the preset graphic can be implemented through HTML code.
[0059] In this embodiment, when a conditional rule is entered in the rule editing area of the conditional editor, a selection list is generated based on the input content, and the selection list only displays rule components and / or condition configuration items that match the input content, and the rule components and condition configuration items are all preset content, thereby avoiding the user from mistakenly entering other non-existent information when entering rule components and / or condition configuration items; after the input is completed, the rule components and / or condition configuration items are displayed in the rule editing area, and the condition configuration items displayed in the rule editing area have preset graphics that are the same as the preset configuration conditions, so that the visual style of the condition configuration items in the rule editing area and the condition configuration area are unified, and the association relationship between the two parts is enhanced, thereby making it easier for users to understand the meaning of the rule expression and reducing the user's understanding cost.
[0060] In some embodiments, step S101 generates a selection list based on the input content in response to an input operation on the rule editing area, including: obtaining a focus event of the rule editing area, determining the position information of the cursor in the rule editing area, and generating the selection list based on the position information.
[0061] In this embodiment, by monitoring the focus (onFocus) event of the rule editing area 100, the specific position of the cursor in the rule editing area 100 is calculated, and the selection list 110 is displayed at the position, so that the selection list 110 always changes with the position of the cursor.
[0062] In some embodiments, the method further includes: monitoring a content change event of the rule editing area to obtain the input content.
[0063] In this embodiment, the content input by the user in the rule editing area 100 is obtained by monitoring the content change (onChange) event of the rule editing area 100. The input content may include condition configuration items and at least part of the characters of the rule component.
[0064] When the input content includes the conditional configuration item, the conditional configuration item with a preset graphic is displayed in the selection list 110. Figure 4 As shown, when the input content is conditional configuration item 1, the matching text response function is called to match the ten configuration conditions preset in the conditional configuration area 200 with conditional configuration item 1, where the matching rule can be regular matching or other arbitrary rules for matching, which is not limited in this embodiment.
[0065] When the matching text response function is called to perform regular matching on the ten configuration conditions preset in the condition configuration area 200 and the condition configuration item 1 to obtain configuration conditions 1 and 10, and the preset graphic, i.e., the graphic of the configuration condition, is a circle, the condition configuration items with the preset graphic displayed in the selection list 110 are ① and ⑩.
[0066] When the input content includes at least part of the characters of the rule component, all the rule components including the at least part of the characters are displayed in the selection list 110. Figure 5 As shown, when the input content is letter a, since letter a only belongs to some characters in the preset regular component symbol and, after calling the matching text response function to match the input content letter a, the regular component symbol and is displayed in the selection list 110.
[0067] Among them, the input content described in the above embodiment is part of the display content in the rule editing area 100. For example, the display content of the preset number of digits to the left of the cursor can be taken as the input content; or, the display content between the first digit to the first space to the left of the cursor can be taken as the input content; or it can be other acquisition methods, which are not limited in this embodiment.
[0068] In some embodiments, when the input content is empty, all the condition configuration items and all the rule components with preset graphics are displayed in the selection list. Figure 3As shown, since the input content is empty, that is, the left side of the cursor is empty, a space, a conditional configuration item with a preset graphic that has been entered, or a rule composition symbol that has been entered, all the conditional configuration items with preset graphics and all the rule composition symbols are displayed in the selection list. For example, when the rule editing area 100 only includes three configuration conditions 1, 2, and 3 and the preset rule composition symbols only include and and or, the input content is empty at this time, then ①, ②, ③ and and, or are displayed in the selection list 110. Among them, the order of the conditional configuration items and the rule composition symbols can be sorted as much as possible according to actual needs, for example, the conditional configuration items are on top and the rule composition symbols are on the bottom, or the conditional configuration items are on the bottom and the rule composition symbols are on top, or the conditional configuration items and the rule composition symbols are arranged crosswise, which is not limited in this embodiment.
[0069] In some embodiments, after the selection list 110 is generated, one of the condition configuration items or the rule component is marked in the selection list 110 in the first marking state. Figure 3-Figure 5 As shown, when the selection list 110 displays at least one condition configuration item and / or the rule component, a condition configuration item or rule component is marked as a candidate item in a first marking state. The first marking state can be a marking state such as highlighting, underlining, bolding, or shading, which is not limited in this embodiment.
[0070] After marking a conditional configuration item or rule component in a first marking state as a candidate item, the rule component and / or the conditional configuration item with a preset graphic is displayed in the rule editing area in response to a selection operation on the conditional configuration item or rule component in the first marking state. In this embodiment, the selection operation on the candidate item can be completed by pressing Enter; or by clicking the candidate item with a mouse; or the user can directly enter a complete conditional configuration item or rule component in the rule editing area 100 and then enter a space to complete the input operation, thereby displaying the candidate item in the rule editing area.
[0071] In this embodiment, when the selected item is a conditional configuration item, after the selection operation is completed, the browser API execCommand ('insertHTML') is called to replace the input conditional configuration item with HTML code with a preset style, thereby displaying the conditional configuration item with a preset graphic in the rule editing area 100.
[0072] According to the method for generating rule expressions described in this embodiment, the user can quickly select existing conditional configuration items and rule components by inputting directly in the input box of the rule editing area 100, avoiding the mistake of inputting other non-existent conditional configuration items and rule components; by making the conditional configuration items in the rule editing area 100 and the graphics of the configuration conditions in the condition editing area the same, the visual styles of the conditional serial numbers in the two functional areas are unified, the association between the two parts is enhanced, and the user's understanding cost is reduced; when the conditional serial number of the conditional configuration item is determined, the style of the existing serial number is directly matched, which maintains a simple input operation while enhancing the user's understanding of the function.
[0073] In some embodiments, the method further comprises:
[0074] Step S201: verify the regular expression based on preset verification rules to obtain a verification result.
[0075] In this embodiment, after the user completes input in the rule editing area 100 , that is, after the rule editing area 100 loses focus, the rule expression in the rule editing area 100 is verified using a preset verification rule to obtain a verification result.
[0076] Specifically, the string of the rule expression can be parsed into tokens for verification. Verification rules include: checking whether the brackets in the token are closed, checking whether the left and right sides of the rule component are conditional configuration items, and checking whether the conditional configuration item is in the conditional configuration area.
[0077] Step S203: In response to the verification result of the rule expression being wrong, marking the wrong condition configuration item and / or the rule component in the rule expression in a second marking state.
[0078] When the verification result of the rule expression is erroneous, the erroneous condition configuration item and / or the rule component in the rule expression is marked in the second marking state, thereby facilitating the user to view the erroneous content.
[0079] like Figure 6a As shown, when half of the brackets are missing in the regular expression, the second marking state is used to mark the other half of the brackets, and a prompt "Please complete ()" is given.
[0080] like Figure 6b As shown, when an incorrect rule component symbol ooor is input, the second marking state is used to mark the incorrect rule component symbol ooor, and a prompt "only supports input of existing rule components and, or, (,)" is given.
[0081] like Figure 6cAs shown, when the right side of the rule component "and" lacks a conditional configuration item, the rule component "and" is marked in the second marking state, and a prompt "conditional configuration items are missing before and after the rule component" is given.
[0082] like Figure 6d As shown, when there is no rule component between the condition configuration items ①⑩, the second marking state is used to mark the condition configuration items ①⑩, and a prompt "missing rule component between the condition configuration items" is given.
[0083] The second marking state may be highlighting, bolding, underlining, shadowing, different colors, etc., which is not limited in this embodiment.
[0084] In this embodiment, by checking and marking the rule expressions in the rule editing area 100 , it is possible to help users quickly locate error information and reduce operation costs.
[0085] It should be noted that the method of the embodiments of the present disclosure can be performed by a single device, such as a computer or server. The method of the embodiments of the present disclosure can also be applied in a distributed scenario, where multiple devices cooperate to perform the method. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiments of the present disclosure, and the multiple devices will interact with each other to complete the method.
[0086] It should be noted that the above description is limited to some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0087] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure further provides a device for generating regular expressions.
[0088] refer to Figure 7 , the device comprises:
[0089] The generating module 11 is configured to: generate a selection list based on the input content in response to an input operation on the rule editing area, and display the rule components and / or condition configuration items matching the input content in the selection list.
[0090] The display module 13 is configured to: in response to an input completion operation in the rule editing area, display the rule component and / or the condition configuration item having a preset graphic in the rule editing area to generate a rule expression. The condition configuration item in the selection list is obtained based on a preset configuration condition, and the preset graphic of the condition configuration item displayed in the rule editing area is the same as the graphic of the configuration condition.
[0091] In some embodiments, the generating module 11 is further configured to: obtain a focus event of the rule editing area, determine position information of a cursor in the rule editing area, and generate the selection list based on the position information.
[0092] In some embodiments, the generating module 11 is further configured to monitor content change events in the rule editing area and obtain the input content.
[0093] In some embodiments, the generating module 11 is further configured to implement:
[0094] In response to the input content including the conditional configuration item, displaying the conditional configuration item with a preset graphic in the selection list;
[0095] In response to the input content including at least some characters of the regular component, all the regular components including the at least some characters are displayed in the selection list.
[0096] In some embodiments, the generating module 11 is further configured to: in response to the input content being empty, display all the condition configuration items and all the rule composition symbols having preset graphics in the selection list.
[0097] In some embodiments, the display module 13 is further configured to: mark one of the condition configuration items or the rule component in the selection list in a first marking state;
[0098] In response to a selection operation on the condition configuration item or the rule component in the first marking state, the rule component and / or the condition configuration item with a preset graphic is displayed in the rule editing area.
[0099] In some embodiments, the apparatus is further configured to: verify the regular expression based on a preset verification rule to obtain a verification result;
[0100] In response to a check result of the rule expression being wrong, marking the wrong condition configuration item and / or the rule component in the rule expression in a second marking state.
[0101] For the convenience of description, the above devices are described as being functionally divided into various modules. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0102] The apparatus of the above embodiment is used to implement the corresponding method for generating regular expressions in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be described in detail here.
[0103] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any of the above embodiments when executing the program.
[0104] Figure 8 10 is a schematic diagram showing a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other within the device via the bus 1050.
[0105] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0106] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0107] The input / output interface 1030 is used to connect input / output modules to implement information input and output. The input / output modules can be configured as components within the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.
[0108] The communication interface 1040 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WiFi, Bluetooth, etc.).
[0109] The bus 1050 comprises a path for transmitting information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).
[0110] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of this specification, and does not necessarily include all the components shown in the figure.
[0111] The electronic device of the above embodiment is used to implement the corresponding method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0112] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method described in any of the above embodiments.
[0113] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0114] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0115] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Within the scope of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0116] In addition, to simplify the description and discussion, and so as not to obscure the embodiments of the present disclosure, known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, devices may be shown in the form of block diagrams to avoid obscuring the embodiments of the present disclosure, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure are to be implemented (i.e., these details should be fully within the purview of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it will be apparent to those skilled in the art that the embodiments of the present disclosure may be implemented without these specific details or with variations in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0117] Although the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0118] The embodiments of the present disclosure are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A method for generating a regular expression, characterized in that: include: In response to an input operation on a rule editing area, generating a selection list based on the input content, and displaying rule component symbols and / or condition configuration items matching the input content in the selection list; In response to an input completion operation on the rule editing area, displaying the rule composition symbol and / or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression; Wherein, the conditional configuration item in the selection list is obtained based on a preset configuration condition, and the preset graphic of the conditional configuration item displayed in the rule editing area is the same as the graphic of the configuration condition; The displaying of the rule components and / or conditional configuration items matching the input content in the selection list includes: in response to the input content including the conditional configuration item, displaying the conditional configuration item with a preset graphic in the selection list; in response to the input content including at least part of the characters of the rule components, displaying all of the rule components including the at least part of the characters in the selection list.
2. The method according to claim 1, characterized in that The step of generating a selection list based on input content in response to an input operation on the rule editing area includes: A focus event of the rule editing area is acquired, position information of a cursor in the rule editing area is determined, and the selection list is generated based on the position information.
3. The method according to claim 1, characterized in that The displaying of rule components and / or condition configuration items matching the input content in the selection list further includes: In response to the input content being empty, all the condition configuration items and all the rule composition symbols having preset graphics are displayed in the selection list.
4. The method according to claim 1 or 3, characterized in that Also includes: Marking one of the condition configuration items or the rule component in the selection list in a first marking state; In response to a selection operation on the condition configuration item or the rule component in the first marking state, the rule component and / or the condition configuration item with a preset graphic is displayed in the rule editing area.
5. The method according to claim 1, wherein Also includes: Verify the regular expression based on preset verification rules to obtain a verification result; In response to a verification result of the rule expression being wrong, marking the wrong condition configuration item and / or the rule component in the rule expression in a second marking state.
6. A device for generating regular expressions, characterized in that: include: The generating module is configured to: in response to an input operation on the rule editing area, generate a selection list based on the input content, and display the rule components and / or condition configuration items matching the input content in the selection list, including: in response to the input content including the condition configuration item, displaying the condition configuration item with a preset graphic in the selection list; in response to the input content including at least part of the characters of the rule components, displaying all the rule components including the at least part of the characters in the selection list; A display module is configured to: in response to an input completion operation on the rule editing area, display the rule composition symbol and / or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression; Wherein, the conditional configuration item in the selection list is obtained based on a preset configuration condition, and the preset graphic of the conditional configuration item displayed in the rule editing area is the same as the graphic of the configuration condition; The generation module is further configured to: in response to the input content including the conditional configuration item, display the conditional configuration item with a preset graphic in the selection list; in response to the input content including at least part of the characters of the rule component, display all of the rule component including the at least part of the characters in the selection list.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Regular expression matching method, system and equipment
CN109408682A
Method for generating business rule expression and computing device
CN110045953A
Rule configuration method and device executed in computer device
CN110187874A