CN115080022A - Method and device for generating regular expression, electronic equipment and storage medium - Google Patents
Method and device for generating regular expression, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN115080022A CN115080022A CN202210658977.7A CN202210658977A CN115080022A CN 115080022 A CN115080022 A CN 115080022A CN 202210658977 A CN202210658977 A CN 202210658977A CN 115080022 A CN115080022 A CN 115080022A
- Authority
- CN
- China
- Prior art keywords
- rule
- condition configuration
- selection list
- preset
- editing area
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/34—Graphical or visual programming
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The disclosure provides a method, an apparatus, an electronic device and a storage medium for generating a regular expression. The method comprises the following steps: in response to an input operation aiming at a rule editing area, generating a selection list based on input content, and displaying rule composition symbols and/or condition configuration items matched with the input content in the selection list; displaying the rule composer and/or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression in response to an input completion operation for the rule editing area; the condition configuration items in the selection list are obtained based on preset configuration conditions, and preset graphs of the condition configuration items displayed in the rule editing area are the same as graphs of the configuration conditions.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a regular expression, an electronic device, and a storage medium.
Background
At present, a common rule editor is generally used, and a rule editing command is input through a keyboard manually to generate a corresponding rule, so that data is processed by the generated rule.
However, the above rule approach requires the user to be familiar with the corresponding regular expression, and the expression needs to be manually reconstructed each time the expression is created; even with a previously established expression, the expression needs to be manually adjusted into a new expression. In the process of constructing the expression, when the character quantity of the expression is large, the logic rule of the expression is quite complex, and no matter the expression is newly built or the existing expression is rewritten, long working time is consumed, and the processing efficiency is low.
Disclosure of Invention
In view of the above, an object of the present disclosure is to provide a method, an apparatus, an electronic device, and a storage medium for generating a regular expression.
Based on the above object, the present disclosure provides a method for generating a regular expression, including:
in response to an input operation aiming at a rule editing area, generating a selection list based on input content, and displaying rule composition symbols and/or condition configuration items matched with the input content in the selection list;
displaying the rule composer and/or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression in response to an input completion operation for the rule editing area;
the condition configuration items in the selection list are obtained based on preset configuration conditions, and preset graphs of the condition configuration items displayed in the rule editing area are the same as graphs of the configuration conditions.
Optionally, the generating a selection list based on the input content in response to the input operation for the rule editing area includes:
and acquiring a focus event of the rule editing area, determining the position information of a cursor in the rule editing area, and generating the selection list based on the position information.
Optionally, the displaying, in the selection list, the rule component and/or the condition configuration item that matches the input content includes:
displaying the condition configuration item with a preset graph in the selection list in response to the input content comprising the condition configuration item;
in response to the input content including at least a portion of the characters of the rule composer, displaying all of the rule composer including the at least a portion of the characters in the selection list.
Optionally, the displaying, in the selection list, the rule component and/or the condition configuration item that matches the input content further includes:
and responding to the input content being empty, displaying all the condition configuration items with preset graphs and all the rule composers in the selection list.
Optionally, the method further includes:
marking one of said conditional configuration items or said rule composers in said selection list with a first marking state;
in response to a selection operation of the condition configuration item or the rule composer in the first marker state, the rule composer and/or the condition configuration item having a preset graphic is displayed in the rule edit region.
Optionally, the method further includes:
verifying the rule expression based on a preset verification rule to obtain a verification result;
and in response to the check result of the regular expression is wrong, marking the wrong conditional configuration item and/or the wrong rule composer in the regular expression by using a second marking state.
The present disclosure also provides an apparatus for generating a regular expression, including:
a generation module configured to: in response to an input operation aiming at a rule editing area, generating a selection list based on input content, and displaying rule composition symbols and/or condition configuration items matched with the input content in the selection list;
a display module configured to: displaying the rule composer and/or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression in response to an input completion operation for the rule editing area;
the condition configuration items in the selection list are obtained based on preset configuration conditions, and preset graphs of the condition configuration items displayed in the rule editing area are the same as graphs of the configuration conditions.
Optionally, the generating module is further configured to:
displaying the condition configuration item with a preset graph in the selection list in response to the input content comprising the condition configuration item;
in response to the input content including at least a portion of the characters of the rule composer, displaying all of the rule composer including the at least a portion of the characters in the selection list.
The present disclosure also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method as claimed in any one of the above when executing the program.
The present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform any of the methods described above.
As can be seen from the foregoing, according to the method, apparatus, electronic device and storage medium for generating a rule expression provided by the present disclosure, when a rule editing area of a condition editor performs condition rule input, a selection list is generated based on input content, where the selection list only displays rule formation symbols and/or condition configuration items matched with the input content, and the rule formation symbols and the condition configuration items are preset contents, so as to prevent a user from missing other nonexistent information when inputting the rule formation symbols and/or the condition configuration items; after the input is finished, the rule composition symbols and/or the condition configuration items are displayed in the rule editing area, and the condition configuration items displayed in the rule editing area have preset graphs which 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 uniform, the association relationship between the rule editing area and the condition configuration area is enhanced, the purpose that a user can understand the meaning of the rule expression more easily is achieved, and the understanding cost of the user is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a diagram illustrating a condition editor according to the related art;
FIG. 2 is a schematic flow chart illustrating a method for generating a regular expression according to an embodiment of the present disclosure;
FIG. 3 is a first diagram of rule editing according to an embodiment of the present disclosure;
FIG. 4 is a second diagram of rule editing according to an embodiment of the present disclosure;
FIG. 5 is a third diagram illustrating rule editing according to an embodiment of the disclosure;
fig. 6a is a first diagram illustrating a checking result of a regular expression according to the embodiment of the disclosure;
FIG. 6b is a second diagram illustrating a checking result of a regular expression according to the embodiment of the disclosure;
fig. 6c is a third schematic diagram of a check result of the regular expression according to the embodiment of the disclosure;
FIG. 6d is a fourth diagram illustrating a checking result of a regular expression according to the embodiment of the disclosure;
fig. 7 is a schematic structural diagram of an apparatus for generating a regular expression according to the embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
For the purpose of promoting a better understanding of the objects, aspects and advantages of the present disclosure, reference is made to the following detailed description taken in conjunction with the accompanying drawings.
It is to be noted that technical terms or scientific terms used in the embodiments of the present disclosure should have a general meaning as understood by those having ordinary skill in the art to which the present disclosure belongs, unless otherwise defined. The use of "first," "second," and similar terms in the embodiments of the disclosure is not intended to indicate any order, quantity, or importance, but rather to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element or item listed before the word covers the element or item listed after the word and its equivalents, but does not exclude other elements or items. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used merely to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
As described in the background art, as shown in fig. 1, when customizing a complex logic, a condition editor in the prior art needs to generate a plurality of configuration conditions by adding conditions in a condition configuration area 200, and then directly input a numerical sequence number of the configuration conditions and preset operators in a rule editing area 100 to define rules among the condition configuration items, thereby implementing the definition of the complex logic rules.
However, because the two parts, namely the numerical sequence number for representing the configuration condition and the operator for representing the rule between the configuration conditions, are independently operated, no close elements exist visually, so that the two parts have weak association, a user needs to have certain understanding and learning cost, and the user cannot use the device directly, so that the user is easy to lose mistakes; at the same time, this way of directly inputting conditional configuration items and operators is close to writing code, resulting in high learning cost.
In view of the above, the embodiments of the present disclosure provide a method for generating a regular expression to solve the above technical problem. As shown in fig. 2, the method includes:
step S101, responding to the input operation of the rule editing area, generating a selection list based on the input content, and displaying the rule composition character and/or the condition configuration item matched with the input content in the selection list.
As shown in fig. 2, the display page of the condition editor includes a condition configuration area 200 and a rule editing area 100. Before the rule editing area 100 performs rule editing, a plurality of configuration conditions may be generated in the condition configuration area 200. The configuration condition may include a plurality of attribute information such as a left value, an operator, a specified value, and a right value, and the content of one configuration condition is defined by the plurality of attribute information.
In the present embodiment, the rule edit area 100 may be an input box. When text input is performed in the rule edit region 100 to generate input content, a selection list 110 may be generated based on the input content, and the selection list 110 is displayed with rule composers and/or condition configuration items matching the input content.
In some embodiments, the rule composer may include parentheses, logical operators, arithmetic operators, relational operators, and/or function process names. Logical operators may include, but are not limited to and (logical and), or (logical or), xor (logical exclusive or), not (logical not), and the like; arithmetic operators may include, but are not limited to + (addition), - (subtraction), (multiplication),/(division),% (remainder),! (factorial operation), etc.; relational operators can include, but are not limited to > (greater than), < (less than), < equal to ≦ ≧ (greater than or equal to), ≠ (not equal to), and the like.
In some embodiments, the condition configuration item is used to represent a preset configuration condition, different configuration conditions have different condition configuration items, and the condition configuration item can be used to represent the configuration condition. In some embodiments, the condition configuration item may be a condition serial number of each configuration condition, and the condition serial number may be a numerical serial number, such as 1, 2, 3 … …; alternatively, the condition number may be a letter number, such as a, b, c … …; alternatively, the condition number may be any other number, and this embodiment is not limited to this. When the business processing is carried out based on the regular expression containing the condition configuration item, the content of the configuration condition corresponding to the condition configuration item can be called to realize the business processing.
In the present embodiment, the condition configuration items displayed in the selection list 110 are obtained based on the configuration conditions set in advance in the condition configuration area 200, and for example, when three configuration conditions are set in the condition configuration area 200, only three condition configuration items corresponding to the three configuration conditions are displayed in the selection list 110, and the condition configuration items of the configuration conditions not set in the condition configuration area 200 are not displayed. Accordingly, the rule component displayed in the selection list 110 is also a preset rule component, and the rule component that is not allowed to be input in the rule edit area 100 is not displayed.
Step S103, responding to the input completion operation aiming at the rule editing area, and displaying the rule composition symbol and/or the condition configuration item with a preset graph in the rule editing area to generate a rule expression; the condition configuration items in the selection list are obtained based on preset configuration conditions, and preset graphs of the condition configuration items displayed in the rule editing area are the same as graphs of the configuration conditions.
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 having a preset graphic may be displayed in the rule editing area 100, so as to generate a rule expression formed by the condition configuration item and the rule component. The preset pattern may be a circle, a rectangle, a triangle, a regular polygon, etc., which is not limited in this embodiment. Taking a circle as an example, when the condition configuration items are condition serial numbers 1, 2 and 3 … …, the condition configuration items with preset graphs are (i), (ii) and (iii) … …; when the condition configuration items are the condition serial numbers a, b and c … …, the condition configuration items with the preset graphs are the condition configuration items
In this embodiment, the preset graph of the condition configuration item displayed in the rule editing area 100 is the same as the graph of the configuration condition in the condition configuration area 200. As shown in fig. 3, if the graphic of each configuration condition in the condition configuration area 200 is a circle, the condition configuration item having the preset graphic displayed in the rule editing area 100 is also a circle.
Optionally, in this embodiment, the condition configuration item with the preset graphics may be implemented based on an HTML code.
In this embodiment, when the rule editing area of the condition editor performs condition rule input, a selection list is generated based on input content, the selection list only displays rule formation symbols and/or condition configuration items matched with the input content, and the rule formation symbols and the condition configuration items are preset contents, so that the condition editor prevents a user from inputting other nonexistent information when the rule formation symbols and/or the condition configuration items are mistakenly input; after the input is finished, the rule composition symbols and/or the condition configuration items are displayed in the rule editing area, and the condition configuration items displayed in the rule editing area have preset graphs which 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 uniform, the association relationship between the rule editing area and the condition configuration area is enhanced, the purpose that a user can understand the meaning of the rule expression more easily is achieved, and the understanding cost of the user is reduced.
In some embodiments, the generating a selection list based on the input content in response to the input operation for the rule editing region in step S101 includes: and acquiring a focus event of the rule editing area, determining the position information of a cursor in the rule editing area, and generating the selection list based on the position information.
In the present embodiment, by listening to an event of focus (onFocus) of the rule editing area 100, a 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 is changed with the position of the cursor all the time.
In some embodiments, the method further comprises: and monitoring the content change event of the rule editing area to acquire the input content.
In the present embodiment, the content input by the user in the rule editing area 100 is obtained by listening to a content change (onChange) event in the rule editing area 100. The input content may include condition configuration items and at least part of characters of the rule composition characters.
When the input content includes the condition configuration item, the condition configuration item having a preset graphic is displayed in the selection list 110. As shown in fig. 4, when the input content is a condition configuration item 1, a matching text response function is called to match ten configuration conditions preset in the condition configuration area 200 with the condition configuration item 1, where the matching rule may be a regular matching or any other rule, which is not limited in this embodiment.
When a matching text response function is called to perform regular matching on ten preset configuration conditions in the condition configuration area 200 and the condition configuration item 1 to obtain configuration conditions 1 and 10, and a preset graph, that is, a graph of the configuration conditions, is a circle, the condition configuration items with the preset graphs displayed in the selection list 110 are (r) and (r).
When the input content includes at least a part of the characters of the rule composer, all of the rule composers including the at least part of the characters are displayed on the selection list 110. As shown in fig. 5, when the input content is the letter a, since the letter a only belongs to a part of the preset rule components and, after the matching text response function is called to match the letter a of the input content, the rule components and are displayed in the selection list 110.
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 with the preset digit on the left side of the cursor may be taken as the input content; or, the display content between the first position on the left side of the cursor and the first space is taken as the input content; or other acquisition manners may be adopted, which is not limited in this embodiment.
In some embodiments, when the input content is empty, all the condition configuration items and all the rule composers having preset graphics are displayed in the selection list. As shown in fig. 3, when the input content is empty, that is, the left side of the cursor is empty, a space is empty, a condition configuration item with a preset pattern is already input, or a rule component is already input, all the condition configuration items with preset patterns and all the rule components are displayed in the selection list. For example, when the rule editing area 100 includes only 1, 2, and 3 configuration conditions and the preset rule composition symbol includes only an and or, and the input content is empty, the selection list 110 displays (i), (ii), and (iii). The order of the condition configuration items and the rule formation symbols may be sorted according to actual needs, for example, the condition configuration items are above and the rule formation symbols are below, or the condition configuration items are below and the rule formation symbols are above, or the condition configuration items and the rule formation symbols are arranged in an intersecting manner, which is not limited in this embodiment.
In some embodiments, after the selection list 110 is generated, one of the conditional configuration items or the rule composers is marked in the selection list 110 in a first marking state. As shown in fig. 3 to 5, when the selection list 110 displays at least one condition configuration item and/or the rule component, a condition configuration item or the rule component is marked with a first mark state as a candidate. The first marked state may be a marked state such as highlight, underline, boldface, shadow, etc., which is not limited in this embodiment.
After marking a condition configuration item or a rule component in a first marking state as a candidate, responding to the selection operation of the condition configuration item or the rule component in the first marking state, and displaying the rule component and/or the condition configuration item with a preset graph in the rule editing area. In the embodiment, the selection operation of the option to be treated can be realized by returning; or clicking the to-be-selected item through a mouse to complete the selection operation of the to-be-selected item; or the user directly inputs a blank space after the complete condition configuration item or rule composition symbol is input in the rule editing area 100 to complete the input operation, so that the to-be-selected item is displayed in the rule editing area.
In the present embodiment, when the to-be-selected item is a condition configuration item, after the selection operation is completed, a browser APIexecCommand ('insertHTML') is called, and the input condition configuration item is replaced with HTML code having a preset style, so that the condition configuration item having a preset graphic is displayed in the rule edit area 100.
In the method for generating a rule expression according to this embodiment, a user can directly and quickly select existing condition configuration items and rule components in an input mode in an input box of the rule editing area 100, thereby avoiding the input of other condition configuration items and rule components which do not exist; by enabling the condition configuration items in the rule editing area 100 to be the same as the graphs of the configuration conditions in the condition editing area, the condition serial number visual styles in the two functional areas are unified, the association relation between the two parts is enhanced, and the understanding cost of a user is reduced; when the condition serial number of the condition configuration item is matched, the style of the existing serial number is directly matched, so that the understanding of the user to the function is enhanced while the simple input operation is kept.
In some embodiments, the method further comprises:
step S201, the rule expression is verified based on a preset verification rule, and a verification result is obtained.
In this embodiment, after the user completes the 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 by using the preset verification rule, so as to obtain the verification result.
Specifically, the character string of the regular expression may be parsed into token for verification. The verification rule comprises the following steps: and checking whether brackets in the token are closed, checking whether the left side and the right side of the rule composition symbol are condition configuration items, checking whether the condition configuration items are in a condition configuration area, and the like.
Step S203, in response to the check result of the regular expression is wrong, marking the wrong condition configuration item and/or the wrong rule component in the regular expression by using a second marking state.
When the check result of the regular expression has errors, the condition configuration items and/or the rule composition symbols which have errors in the regular expression are marked in a second marking state, so that a user can conveniently view the contents of the errors.
As shown in fig. 6a, when half of bracket is missing in the regular expression, the other half of bracket is marked with a second marker state and prompts "please supplement the complete ()".
As shown in FIG. 6b, when the wrong rule composition symbol ooor is input, the wrong rule composition symbol ooor is marked with a second flag state, and the prompt "only supports the input of the existing rule composition symbols and, or, ()".
As shown in fig. 6c, when the right side of the rule component and lacks a condition configuration item, the rule component and is marked with a second mark state, and "the condition configuration item is absent before and after the rule component".
As shown in fig. 6d, when conditional configuration item r has no rule component symbol, a second flag state is used to flag conditional configuration item r and indicate "rule component symbol missing between conditional configuration items".
The second mark state may be a mark state such as highlight, bold, underline, shadow, different color, and the like, which is not limited in this embodiment.
In this embodiment, the user can be helped to quickly locate the error information by checking and marking the rule expression in the rule editing area 100, and the operation cost is reduced.
It should be noted that the method of the embodiments of the present disclosure may be executed by a single device, such as a computer or a server. The method of the embodiment can also be applied to a distributed scene and completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the devices may only perform one or more steps of the method of the embodiments of the present disclosure, and the devices may interact with each other to complete the method.
It should be noted that the above describes some embodiments of the disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments described above and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Based on the same inventive concept, corresponding to the method of any embodiment, the disclosure also provides a device for generating the regular expression.
Referring to fig. 7, the apparatus includes:
a generating module 11 configured to: in response to an input operation for a rule editing area, a selection list is generated based on input content, and rule composers and/or condition configuration items matching the input content are displayed in the selection list.
A display module 13 configured to: displaying the rule composer and/or the condition configuration item having a preset graphic in the rule editing region to generate a rule expression in response to an input completion operation for the rule editing region. The condition configuration items in the selection list are obtained based on preset configuration conditions, and preset graphs of the condition configuration items displayed in the rule editing area are the same as graphs of the configuration conditions.
In some embodiments, the generating module 11 is further configured to implement: and acquiring a focus event of the rule editing area, determining the position information of a cursor in the rule editing area, and generating the selection list based on the position information.
In some embodiments, the generating module 11 is further configured to implement: and monitoring the content change event of the rule editing area to acquire the input content.
In some embodiments, the generating module 11 is further configured to implement:
displaying the condition configuration item with a preset graph in the selection list in response to the input content comprising the condition configuration item;
in response to the input content including at least a portion of the characters of the rule composer, displaying all of the rule composer including the at least a portion of the characters in the selection list.
In some embodiments, the generating module 11 is further configured to implement: and responding to the input content being empty, displaying all the condition configuration items with preset graphs and all the rule composers in the selection list.
In some embodiments, the display module 11 is further configured to: marking one of said conditional configuration items or said rule composers in said selection list with a first marking state;
in response to a selection operation of the condition configuration item or the rule composer in the first marker state, the rule composer and/or the condition configuration item having a preset graphic is displayed in the rule edit region.
In some embodiments, the apparatus is further configured to: verifying the rule expression based on a preset verification rule to obtain a verification result;
and in response to the verification result of the regular expression is wrong, marking the wrong condition configuration item and/or the wrong rule component in the regular expression by using a second marking state.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the various modules may be implemented in the same one or more software and/or hardware implementations of the present disclosure.
The apparatus in the foregoing embodiment is used to implement the method for generating a regular expression in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present disclosure further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the program, the method according to any of the above embodiments is implemented.
Fig. 8 is a schematic diagram illustrating a more specific hardware structure of an electronic device according to this embodiment, where the electronic device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
It should be noted that although the above-mentioned 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, those skilled in the art will appreciate that the above-described apparatus may also include only the components necessary to implement the embodiments of the present disclosure, and need not include all of the components shown in the figures.
The electronic device of the above embodiment is used to implement the corresponding method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method according to any of the above embodiments, corresponding to any of the above-described embodiment methods.
Computer-readable media of the present embodiments, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method according to any of the above embodiments, and have the beneficial effects of the corresponding method embodiment, and are not described herein again.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the idea of the present disclosure, also technical features in the above embodiments or in different embodiments may be combined, 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 brevity.
In addition, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown in the provided figures for simplicity of illustration and discussion, and so as not to obscure the embodiments of the disclosure. Furthermore, devices may be shown in block diagram form in order to avoid obscuring embodiments of the present disclosure, and this also takes into account the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the embodiments of the present disclosure are to be implemented (i.e., specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the disclosure, it should be apparent to one skilled in the art that the embodiments of the disclosure can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative instead of restrictive.
While 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 of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic ram (dram)) may use the discussed embodiments.
The disclosed embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalents, improvements, and the like that may be made within the spirit and principles of the embodiments of the disclosure are intended to be included within the scope of the disclosure.
Claims (10)
1. A method of generating a regular expression, comprising:
in response to an input operation aiming at a rule editing area, generating a selection list based on input content, and displaying rule composition symbols and/or condition configuration items matched with the input content in the selection list;
displaying the rule composer and/or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression in response to an input completion operation for the rule editing area;
the condition configuration items in the selection list are obtained based on preset configuration conditions, and preset graphs of the condition configuration items displayed in the rule editing area are the same as graphs of the configuration conditions.
2. The method of claim 1, wherein generating a selection list based on input content in response to an input operation for a rule edit region comprises:
and acquiring a focus event of the rule editing area, determining the position information of a cursor in the rule editing area, and generating the selection list based on the position information.
3. The method according to claim 1, wherein the displaying rule composers and/or condition configuration items matched with the input content in the selection list comprises:
displaying the condition configuration item with a preset graph in the selection list in response to the input content comprising the condition configuration item;
in response to the input content including at least a portion of the characters of the rule composer, displaying all of the rule composer including the at least a portion of the characters in the selection list.
4. The method according to claim 1, wherein the displaying rule composers and/or condition configuration items matched with the input content in the selection list further comprises:
and responding to the input content being empty, displaying all the condition configuration items with preset graphs and all the rule composers in the selection list.
5. The method of claim 3 or 4, further comprising:
marking one of said conditional configuration items or said rule composers in said selection list with a first marking state;
in response to a selection operation of the condition configuration item or the rule composer in the first flag state, the rule composer and/or the condition configuration item having a preset graphic is displayed in the rule edit area.
6. The method of claim 1, further comprising:
verifying the rule expression based on a preset verification rule to obtain a verification result;
and in response to the check result of the regular expression is wrong, marking the wrong conditional configuration item and/or the wrong rule composer in the regular expression by using a second marking state.
7. An apparatus for generating regular expressions, comprising:
a generation module configured to: in response to an input operation aiming at a rule editing area, generating a selection list based on input content, and displaying rule composition symbols and/or condition configuration items matched with the input content in the selection list;
a display module configured to: displaying the rule composer and/or the condition configuration item with a preset graphic in the rule editing area to generate a rule expression in response to an input completion operation for the rule editing area;
the condition configuration items in the selection list are obtained based on preset configuration conditions, and preset graphs of the condition configuration items displayed in the rule editing area are the same as graphs of the configuration conditions.
8. The apparatus of claim 7, wherein the generation module is further configured to:
displaying the condition configuration item with a preset graph in the selection list in response to the input content comprising the condition configuration item;
in response to the input content including at least a portion of the characters of the rule composer, displaying all of the rule composer including the at least a portion of the characters in the selection list.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 6 when executing the program.
10. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210658977.7A CN115080022A (en) | 2022-06-09 | 2022-06-09 | Method and device for generating regular expression, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210658977.7A CN115080022A (en) | 2022-06-09 | 2022-06-09 | Method and device for generating regular expression, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115080022A true CN115080022A (en) | 2022-09-20 |
Family
ID=83250444
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210658977.7A Pending CN115080022A (en) | 2022-06-09 | 2022-06-09 | Method and device for generating regular expression, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115080022A (en) |
-
2022
- 2022-06-09 CN CN202210658977.7A patent/CN115080022A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107992304B (en) | Method and device for generating display interface | |
CN108292231B (en) | Method and system for generating applications from data | |
US7610548B1 (en) | Method and apparatus for applying locale behaviors to regions of a form | |
US20170109136A1 (en) | Generation of application behaviors | |
CN111813409A (en) | Code generation method, device, equipment and storage medium of interactive interface | |
CN112068911B (en) | Electronic form generation method, device, system, equipment and medium | |
CN112306486B (en) | Interface generation method and device, server and storage medium | |
CN104375814A (en) | Generation method and device of an interface document | |
CN110609981A (en) | Text processing method and device, electronic equipment and computer readable storage medium | |
CN116009863B (en) | Front-end page rendering method, device and storage medium | |
CN112068828A (en) | Title control generation method, device, system, equipment and medium | |
CN115080022A (en) | Method and device for generating regular expression, electronic equipment and storage medium | |
CN115543288A (en) | Code information generation method, device, equipment and storage medium | |
CN111475156B (en) | Page code generation method and device, electronic equipment and storage medium | |
CN115145559A (en) | Configuration management method, device and equipment based on Flutter | |
CN115081423A (en) | Document editing method and device, electronic equipment and storage medium | |
CN115291857A (en) | Visual business rule arranging method and configurator | |
CN112487773A (en) | Report generation method, device, equipment and storage medium | |
CN113811849A (en) | System and method for computer-aided computer programming | |
CN113553798B (en) | Seal insertion method and device, electronic equipment and storage medium | |
CN112784542B (en) | Document editing method and device | |
CN112183021B (en) | Digital generation method and device | |
CN115422916A (en) | Data access method, data access device, electronic equipment, storage medium and program product | |
CN113011130A (en) | Character animation editing method and device, electronic equipment and storage medium | |
CN115455323A (en) | Method, device, equipment and medium for verifying data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |