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 PDF

Info

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
selection list
editing area
configuration item
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
Application number
CN202210658977.7A
Other languages
Chinese (zh)
Inventor
张璐
连桂泉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202210658977.7A priority Critical patent/CN115080022A/en
Publication of CN115080022A publication Critical patent/CN115080022A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, 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

本公开提供一种生成规则表达式的方法、装置、电子设备及存储介质。所述方法包括:响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,并在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项;响应于针对所述规则编辑区的输入完成操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项以生成规则表达式;其中,所述选择列表中所述条件配置项基于预设的配置条件获得,所述规则编辑区显示的所述条件配置项的预设图形与所述配置条件的图形相同。

Figure 202210658977

The present disclosure provides a method, apparatus, electronic device, and storage medium for generating a regular expression. The method includes: in response to an input operation for the rule editing area, generating a selection list based on the input content, and displaying rule components and/or condition configuration items matching the input content in the selection list; The input of the rule editing area completes the operation, and the rule component and/or the condition configuration item with the preset graphic is displayed in the rule editing area to generate the rule expression; wherein, all items in the selection list are displayed. The condition configuration item is obtained based on a preset configuration condition, and the preset graph of the condition configuration item displayed in the rule editing area is the same as the graph of the configuration condition.

Figure 202210658977

Description

生成规则表达式的方法、装置、电子设备及存储介质Method, apparatus, electronic device and storage medium for generating regular expression

技术领域technical field

本公开涉及计算机技术领域,尤其涉及一种生成规则表达式的方法、装置、电子设备及存储介质。The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, an electronic device, and a storage medium for generating a regular expression.

背景技术Background technique

目前,通常是利用普通的规则编辑器,通过键盘手动输入的方式来输入规则编辑命令以生成相应的规则,以利用生成的规则对数据进行处理。At present, a common rule editor is usually used to input rule editing commands manually through a keyboard to generate corresponding rules, so as to use the generated rules to process data.

但是,上述规则的方式需要使用者对相应的规则表达式非常熟悉,并且每次创建表达式时都需要重新手动构建表达式;即使是利用先前已建立的表达式,也需要将该表达式手动调整到新的表达式中。在上述构建表达式的过程中,当表达式的字符量较多时,表达式的逻辑规则会相当复杂,无论是新建表达式,还是重写已有的表达式,都会耗费较长的工作时间,处理效率较低。However, the method of the above rules requires users to be very familiar with the corresponding regular expressions, and each time an expression is created, the expression needs to be rebuilt manually; even if a previously established expression is used, the expression needs to be manually adjusted to the new expression. In the above process of constructing an expression, when the number of characters in the expression is large, the logic rules of the expression will be quite complicated. Whether it is to create a new expression or rewrite an existing expression, it will take a long time to work. Processing efficiency is low.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本公开的目的在于提出一种生成规则表达式的方法、装置、电子设备及存储介质。In view of this, the purpose of the present disclosure is to provide a method, apparatus, electronic device and storage medium for generating a regular expression.

基于上述目的,本公开提供了一种生成规则表达式的方法,包括:Based on the above purpose, the present disclosure provides a method for generating a regular expression, including:

响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,并在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项;In response to an input operation for the rule editing area, a selection list is generated based on the input content, and a rule component and/or condition configuration item matching the input content is displayed in the selection list;

响应于针对所述规则编辑区的输入完成操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项以生成规则表达式;In response to the input completion operation for the rule editing area, displaying the rule component and/or the condition configuration item with a preset graphic 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 graph of the condition configuration item displayed in the rule editing area is the same as the graph of the configuration condition.

可选的,所述响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,包括:Optionally, generating a selection list based on the input content in response to an input operation in the rule editing area, including:

获取所述规则编辑区的焦点事件,确定光标在所述规则编辑区中的位置信息,基于所述位置信息生成所述选择列表。The focus event of the rule editing area is acquired, the position information of the cursor in the rule editing area is determined, and the selection list is generated based on the position information.

可选的,所述在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项,包括:Optionally, displaying 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 component, displaying all the rule components including the at least part of the characters in the selection list.

可选的,所述在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项,还包括:Optionally, the displaying in the selection list the rule components and/or condition configuration items that match the input content, further includes:

响应于所述输入内容为空,在所述选择列表中显示具有预设图形的全部所述条件配置项及全部所述规则组成符。In response to the input content being empty, all the condition configuration items with preset graphics and all the rule components are displayed in the selection list.

可选的,还包括:Optionally, also include:

在所述选择列表中以第一标记状态标记一个所述条件配置项或所述规则组成符;Marking one of the condition configuration items or the rule component in the selection list with the first marked state;

响应于对处于所述第一标记状态的所述条件配置项或所述规则组成符的选择操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项。In response to a selection operation on the condition configuration item or the rule component in the first marked state, displaying the rule component and/or the condition with a preset graphic in the rule editing area configuration item.

可选的,还包括:Optionally, also include:

基于预设的校验规则对所述规则表达式进行校验,获得校验结果;Verifying the regular expression based on a preset verification rule to obtain a verification result;

响应于所述规则表达式的校验结果为错,以第二标记状态标记所述规则表达式中错误的所述条件配置项和/或所述规则组成符。In response to the verification result of the regular expression being an error, the conditional configuration item and/or the rule component element that are in error in the regular expression are marked with a second marking state.

本公开还提供了一种生成规则表达式的装置,包括:The present disclosure also provides an apparatus for generating a regular expression, including:

生成模块,被配置为:响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,并在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项;A generating module, configured to: in response to an input operation for the rule editing area, generate a selection list based on the input content, and display the rule component and/or condition configuration item matching the input content in the selection list;

显示模块,被配置为:响应于针对所述规则编辑区的输入完成操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项以生成规则表达式;A display module, configured to: in response to an input completion operation for 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 Mode;

其中,所述选择列表中所述条件配置项基于预设的配置条件获得,所述规则编辑区显示的所述条件配置项的预设图形与所述配置条件的图形相同。Wherein, the condition configuration item in the selection list is obtained based on a preset configuration condition, and the preset graph of the condition configuration item displayed in the rule editing area is the same as the graph of the configuration condition.

可选的,所述生成模块,还被配置为:Optionally, the generating module is further configured to:

响应于所述输入内容包括所述条件配置项,在所述选择列表中显示具有预设图形的所述条件配置项;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 component, displaying all the rule components including the at least part of the characters in the selection list.

本公开还提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述任意一项所述的方法。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, the processor implementing the method according to any one of the above when the processor executes the program .

本公开还提供了一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行上述任一所述的方法。The present disclosure also provides a non-transitory computer-readable storage medium, the 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 above, the method, device, electronic device and storage medium for generating a regular expression provided by the present disclosure will generate a selection list based on the input content when inputting a conditional rule in the rule editing area of the conditional editor, The selection list only displays the rule components and/or condition configuration items that match the input content, and both the rule components and the condition configuration items are preset contents, so as to avoid the user inputting the rule components and/or condition configuration items Other non-existent information is incorrect; 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 the same preset graphics as the preset configuration conditions, making the rule The visual styles of the conditional configuration items in the editing area and the conditional configuration area are unified, and the relationship between the two parts is enhanced, so that the user can more easily understand the meaning of the rule expression and reduce the user's understanding cost.

附图说明Description of drawings

为了更清楚地说明本公开或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the present disclosure or related technologies more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only for the present disclosure. In the embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为相关技术中条件编辑器的条件编辑示意图;Fig. 1 is the conditional editing schematic diagram of conditional editor in the related art;

图2为本公开实施例所述生成规则表达式的方法的流程示意图;2 is a schematic flowchart of a method for generating a regular expression according to an embodiment of the present disclosure;

图3为本公开实施例所述规则编辑的第一示意图;3 is a first schematic diagram of rule editing according to an embodiment of the present disclosure;

图4为本公开实施例所述规则编辑的第二示意图;4 is a second schematic diagram of rule editing according to an embodiment of the present disclosure;

图5为本公开实施例所述规则编辑的第三示意图;5 is a third schematic diagram of rule editing according to an embodiment of the present disclosure;

图6a为本公开实施例所述规则表达式校验结果的第一示意图;FIG. 6a is a first schematic diagram of a regular expression verification result according to an embodiment of the present disclosure;

图6b为本公开实施例所述规则表达式校验结果的第二示意图;FIG. 6b is a second schematic diagram of a regular expression verification result according to an embodiment of the present disclosure;

图6c为本公开实施例所述规则表达式校验结果的第三示意图;FIG. 6c is a third schematic diagram of a regular expression verification result according to an embodiment of the present disclosure;

图6d为本公开实施例所述规则表达式校验结果的第四示意图;FIG. 6d is a fourth schematic diagram of a regular expression verification result according to an embodiment of the present disclosure;

图7为本公开实施例所述生成规则表达式的装置的结构示意图;7 is a schematic structural diagram of an apparatus for generating a regular expression according to an embodiment of the present disclosure;

图8为本公开实施例电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.

具体实施方式Detailed ways

为使本公开的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本公开进一步详细说明。In order to make the objectives, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below with reference to the specific embodiments and the accompanying drawings.

需要说明的是,除非另外定义,本公开实施例使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开实施例中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。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 those with ordinary skill in the art to which the present disclosure belongs. "First", "second" and similar words used in the embodiments of the present disclosure do not denote any order, quantity or importance, but are only used to distinguish different components. "Comprises" or "comprising" and similar words mean that the elements or things appearing before the word encompass the elements or things recited after the word and their equivalents, but do not exclude other elements or things. Words like "connected" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "Down", "Left", "Right", etc. are only used to represent the relative positional relationship, and when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

如背景技术所述,如图1所示,现有技术中的条件编辑器,在自定义复杂逻辑时,首先需要在条件配置区200通过添加条件来生成多条配置条件,再在规则编辑区100中直接输入配置条件的数字序号以及预设的运算符来定义各条件配置项之间的规则,从而实现复杂逻辑规则的定义。As described in the background art, as shown in FIG. 1 , in the condition editor in the prior art, when customizing complex logic, it is first necessary to add conditions in the condition configuration area 200 to generate a plurality of configuration conditions, and then add conditions in the rule editing area. In 100, the numerical serial number of the configuration condition and the preset operator are directly input to define the rules between the configuration items of each condition, thereby realizing the definition of complex logic rules.

然而,由于用于代表配置条件的数字序号以及用于表示各配置条件之间规则的运算符这两部分独立操作,在视觉上没有接近的元素,这导致二者关联感较弱,需要用户具有一定的理解和学习成本,无法直接上手即用,使得用户容易输错;同时,这种直接输入条件配置项和运算符的方式接近写代码,导致学习成本高。However, due to the independent operation of the numerical serial number used to represent the configuration conditions and the operator used to represent the rules between the configuration conditions, there are no visually close elements, which leads to a weak sense of association between the two, requiring users to have Certain understanding and learning costs cannot be used directly, making it easy for users to make mistakes; at the same time, this method of directly inputting conditional configuration items and operators is close to writing code, resulting in high learning costs.

有鉴于此,本公开实施例提供一种生成规则表达式的方法,以解决上述技术问题。如图2所示,所述方法包括:In view of this, an embodiment of the present disclosure provides a method for generating a regular expression to solve the above technical problem. As shown in Figure 2, the method includes:

步骤S101,响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,并在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项。Step S101, in response to an input operation on the rule editing area, generate a selection list based on the input content, and display the rule component and/or condition configuration items matching the input content in the selection list.

如图2所示,条件编辑器的显示页面上包括条件配置区200和规则编辑区100。在规则编辑区100进行规则编辑之前,可先在条件配置区200生成多个配置条件。其中,配置条件可包括左值、操作符、指定值、右值等多个属性信息,通过多个属性信息定义一条配置条件的内容。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 first. The configuration condition may include multiple attribute information such as an lvalue, an operator, a specified value, and an rvalue, and the content of a configuration condition is defined by the multiple attribute information.

在本实施例中,规则编辑区100可以为输入框。当在该规则编辑区100进行文本输入从而生成输入内容时,可基于该输入内容生成选择列表110,且该选择列表110显示有与输入内容匹配的规则组成符和/或条件配置项。In this embodiment, the rule editing area 100 may be an input box. When text input is performed 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 displays rule components and/or condition configuration items matching the input content.

在一些实施例中,规则组成符可以包括括号、逻辑运算符、算术运算符、关系运算符和/或函数处理名称。逻辑运算符可包括但不限于and(逻辑与)、or(逻辑或)、xor(逻辑异或)、not(逻辑非)等;算术运算符可包括但不限于+(加法运算)、-(减法运算)、*(乘法运算)、/(除法运算)、%(求余运算)、!(阶乘运算)等;关系运算符可包括但不限于>(大于)、<(小于)、=(等于)、≤(小于或等于)、≥(大于或等于)、≠(不等于)等。In some embodiments, rule constituents may include parentheses, 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 not), etc.; arithmetic operators may include but are not limited to + (addition), -( Subtraction), * (multiplication), / (division), % (remainder), ! (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.

在一些实施例中,条件配置项用于表示预先设置的配置条件,不同的配置条件具有不同的条件配置项,条件配置项可用于表示该配置条件。在一些实施例,条件配置项可以为各配置条件的条件序号,该条件序号可以为数字序号,例如1、2、3……;或者,条件序号可以为字母序号,例如a、b、c……;或者,条件序号也可以为其他任意形式的序号,本实施例对此不作限制。当基于包含条件配置项的规则表达式进行业务处理时,可调用与条件配置项对应的配置条件的内容实现业务处理。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 the condition serial number of each configuration condition, and the condition serial number may be a numerical serial number, such as 1, 2, 3...; or, the condition serial number may be an alphabetical serial number, such as a, b, c... ...; or, the condition sequence number may also be a sequence number in any other form, which is not limited in this embodiment. When business processing is performed based on the rule expression including the conditional configuration item, the content of the configuration condition corresponding to the conditional configuration item can be invoked to realize the business processing.

在本实施例中,选择列表110所显示的条件配置项基于在条件配置区200中预先设置的配置条件获得,例如当条件配置区200设置有三条配置条件时,选择列表110中仅显示与此三条配置条件对应的三个条件配置项,而不显示条件配置区200未设置的配置条件的条件配置项。相应的,选择列表110所显示的规则组成符也为预设的规则组成符,而不会显示规则编辑区100不允许输入的规则组成符。In this embodiment, the condition configuration items displayed in the selection list 110 are obtained based on the configuration conditions preset in the condition configuration area 200 . For example, when three configuration conditions are set in the condition configuration area 200 , the selection list 110 only displays the same The three condition configuration items corresponding to the three configuration conditions are not displayed, but the condition configuration items of the configuration conditions not set in the condition configuration area 200 are not displayed. Correspondingly, the rule components displayed in the selection list 110 are also preset rule components, and the rule components that are not allowed to be input in the rule editing area 100 are not displayed.

步骤S103,响应于针对所述规则编辑区的输入完成操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项以生成规则表达式;其中,所述选择列表中所述条件配置项基于预设的配置条件获得,所述规则编辑区显示的所述条件配置项的预设图形与所述配置条件的图形相同。Step S103, in response to the input completion operation for 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 condition configuration items in the selection list are obtained based on preset configuration conditions, and the preset graphics of the condition configuration items displayed in the rule editing area are the same as the graphics of the configuration conditions.

本实施例中,当完成对规则组成符和/或条件配置项的输入时,可在规则编辑区100显示规则组成符和/或具有预设图形的条件配置项,从而生成由条件配置项和规则组成符所形成的规则表达式。其中,预设图形可以为圆形、矩形、三角形、正多边形等,本实施例对此不作限制。以圆形为例,当条件配置项为条件序号1、2、3……时,具有预设图形的条件配置项即为①、②、③……;当条件配置项为条件序号a、b、c……时,具有预设图形的条件配置项即为

Figure BDA0003686941540000061
Figure BDA0003686941540000062
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, so as to generate the condition configuration item and the condition configuration item. The regular expression formed by the regular composition. The preset graphics may be circles, rectangles, triangles, regular polygons, etc., which are not limited in this embodiment. Taking a circle as an example, when the condition configuration items are condition numbers 1, 2, 3..., the condition configuration items with preset graphics are ①, ②, ③...; when the condition configuration items are condition numbers a, b , c..., the conditional configuration items with preset graphics are
Figure BDA0003686941540000061
Figure BDA0003686941540000062

本实施例中,所述规则编辑区100显示的所述条件配置项的预设图形与条件配置区200中所述配置条件的图形相同。如图3所示,条件配置区200中各配置条件的图形为圆形,则在规则编辑区100显示的具有预设图形的条件配置项也为圆形。In this embodiment, the preset graphics of the condition configuration items displayed in the rule editing area 100 are the same as the graphics of the configuration conditions in the condition configuration area 200 . As shown in FIG. 3 , 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.

可选的,本实施例中,具有预设图形的条件配置项可以基于通过HTML代码实现。Optionally, in this embodiment, the conditional configuration items with preset graphics may be implemented based on HTML codes.

在本实施例中,在条件编辑器的规则编辑区进行条件规则的输入时,会基于输入内容生成选择列表,该选择列表仅显示与输入内容匹配的规则组成符和/或条件配置项,且规则组成符和条件配置项均为预设的内容,从而避免用户在输入规则组成符和/或条件配置项输错其他不存在的信息;输入完成后在规则编辑区显示规则组成符和/或条件配置项,且规则编辑区所显示的条件配置项具有与预设的配置条件相同的预设图形,使得规则编辑区和条件配置区的条件配置项的视觉样式统一,增强两部分之间的关联关系,从而实现了使得用户可以更容易理解规则表达式的含义,降低用户的理解成本。In this embodiment, when a conditional rule is input in the rule editing area of the condition editor, a selection list is generated based on the input content, and the selection list only displays the rule components and/or condition configuration items that match the input content, and The rule components and condition configuration items are both preset contents, so as to avoid the user from entering other non-existent information incorrectly when entering the rule components and/or condition configuration items; after the input is completed, the rule components and/or the rule editing area are displayed in the rule editing area. Condition configuration items, and the condition configuration items displayed in the rule editing area have the same preset graphics 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 relationship between the two parts is enhanced. The association relationship makes it easier for the user to understand the meaning of the rule expression and reduces the user's understanding cost.

在一些实施例中,步骤S101中所述响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,包括:获取所述规则编辑区的焦点事件,确定光标在所述规则编辑区中的位置信息,基于所述位置信息生成所述选择列表。In some embodiments, in step S101, in response to an input operation for the rule editing area, generating a selection list based on the input content includes: acquiring a focus event of the rule editing area, and determining where the cursor is in the rule editing area. location information on which the selection list is generated based on the location information.

在本实施例中,通过监听规则编辑区100的焦点(onFocus)事件,从而计算出光标在规则编辑区100的具体位置,并在该位置处显示选择列表110,从而使得该选择列表110一直随着光标的位置变化。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 follows the The position of the cursor changes.

在一些实施例中,所述方法还包括:监听所述规则编辑区的内容变化事件,获取所述输入内容。In some embodiments, the method further includes: monitoring a content change event in the rule editing area, and acquiring the input content.

在本实施例中,通过监听规则编辑区100的内容变化(onChange)事件,从而获得用户在规则编辑区100的输入内容。其中,输入内容可以包括条件配置项以及规则组成符的至少部分字符。In this embodiment, the content input by the user in the rule editing region 100 is obtained by monitoring the content change (onChange) event of the rule editing region 100 . Wherein, the input content may include condition configuration items and at least some characters of rule composition characters.

当所述输入内容包括所述条件配置项时,在所述选择列表110中显示具有预设图形的所述条件配置项。如图4所示,当输入内容为条件配置项1时,调用匹配文本响应函数将条件配置区200中预设的十条配置条件与条件配置项1进行匹配,其中该匹配规则可以为正则匹配或其他任意规则进行匹配,本实施例对此不作限制。When the input content includes the condition configuration item, the condition configuration item with a preset graphic is displayed in the selection list 110 . As shown in FIG. 4 , when the input content is conditional configuration item 1, the matching text response function is called to match the ten preset configuration conditions in the conditional configuration area 200 with the conditional configuration item 1, where the matching rule may be regular matching or Other arbitrary rules are matched, which is not limited in this embodiment.

当调用匹配文本响应函数将条件配置区200中预设的十条配置条件与条件配置项1进行正则匹配从而获得配置条件1、10,预设图形即配置条件的图形为圆形时,所述选择列表110中显示的具有预设图形的条件配置项为①、⑩。When the matching text response function is called to perform regular matching between the ten preset configuration conditions in the conditional configuration area 200 and the conditional configuration item 1 to obtain the configuration conditions 1 and 10, and the preset graphics, that is, the graphics of the configuration conditions, are circular, the selection The condition configuration items with preset graphics displayed in the list 110 are ① and ⑩.

当输入内容包括所述规则组成符的至少部分字符,在所述选择列表110显示包括所述至少部分字符的全部所述规则组成符。如图5所示,当输入内容为字母a时,由于字母a仅属于预设的规则组成符and中的部分字符,因此调用匹配文本响应函数将输入内容字母a匹配后,在选择列表110中显示规则组成符and。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 . As shown in FIG. 5 , when the input content is the letter a, since the letter a only belongs to some characters in the preset rule composition and, so after calling the matching text response function to match the input content letter a, the letter a is displayed in the selection list 110 Displays the rule component and.

其中,上述实施例所述的输入内容为规则编辑区100中的部分显示内容,例如可以取光标左侧预设位数的显示内容作为所述输入内容;或者,取光标左侧第一位至第一个空格之间的显示内容作为所述输入内容;或者也可以为其他获取方式,本实施例对此不作限制。Wherein, 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 digits on the left side of the cursor can be taken as the input content; The displayed content between the first spaces is used as the input content; or other acquisition methods may also be used, which is not limited in this embodiment.

在一些实施例中,当输入内容为空时,在所述选择列表中显示具有预设图形的全部所述条件配置项及全部所述规则组成符。如图3所示,由于输入内容为空,即光标左侧为空、空格、已输入完成的具有预设图形的条件配置项或者已输入完成的规则组成符时,在选择列表中显示具有预设图形的全部所述条件配置项及全部所述规则组成符。例如,当规则编辑区100中仅包括1、2、3三条配置条件且预设的规则组成符仅包括and、or时,此时输入内容为空,则在在选择列表110中显示①、②、③以及and、or。其中,条件配置项及规则组成符的顺序可以根据实际需要尽情排序,例如条件配置项在上而规则组成符在下,或者条件配置项在下而规则组成符在上,或者条件配置项与规则组成符交叉设置,在本实施例对此不作限制。In some embodiments, when the input content is empty, all the condition configuration items with preset graphics and all the rule components are displayed in the selection list. As shown in Figure 3, since the input content is empty, that is, the left side of the cursor is empty, space, conditional configuration items with preset graphics that have been entered, or rule components that have been entered, the selection list will display preset graphics. Set all the condition configuration items and all the rule components of the graph. For example, when the rule editing area 100 only includes three configuration conditions 1, 2, and 3 and the preset rule components only include and, or, and the input content is empty at this time, then ①, ② are displayed in the selection list 110 , ③ and and, or. Among them, the order of the condition configuration items and rule components can be sorted according to actual needs, for example, the condition configuration items are on the top and the rule components are on the bottom, or the condition configuration items are on the bottom and the rule components are on the top, or the condition configuration items and the rule components are on the top. The cross setting is not limited in this embodiment.

在一些实施例中,生成选择列表110之后,在所述选择列表110中以第一标记状态标记一个所述条件配置项或所述规则组成符。如图3-图5所示,当选择列表110显示至少一个条件配置项和/或所述规则组成符时,采用第一标记状态标记一个条件配置项或规则组成符作为待选项。其中,第一标记状态可以为高亮、下划线、加粗、阴影等标记状态,本实施例对此不作限制。In some embodiments, after the selection list 110 is generated, one of the condition configuration items or the rule component symbols is marked in the selection list 110 with a first marked state. As shown in FIGS. 3-5 , when the selection list 110 displays at least one condition configuration item and/or the rule component, the first marking state is used to mark one condition configuration item or rule component as a candidate option. The first marking state may be a marking state such as highlight, underline, bold, shadow, etc., which is not limited in this embodiment.

以第一标记状态标记一个条件配置项或规则组成符作为待选项之后,响应于对处于所述第一标记状态的所述条件配置项或所述规则组成符的选择操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项。本实施例中,可通过回车实现对待选项的选择操作;或者,通过鼠标点击待选项完成对待选项的选择操作;或者用户直接在规则编辑区100输入完整的条件配置项或规则组成符后输入空格完成输入操作,从而将待选项显示在规则编辑区中。After marking a condition configuration item or rule component in the first marked state as a candidate option, in response to the selection operation on the condition configuration item or the rule component in the first marked state, in the rule editor The rule component and/or the condition configuration item with preset graphics are displayed in the area. In this embodiment, the selection operation of the treatment option can be realized by pressing Enter; alternatively, the selection operation of the treatment option can be completed by clicking the waiting item with the mouse; or the user directly enters the complete condition configuration item or rule component in the rule editing area 100 and then enters the input Space to complete the input operation, thereby displaying the pending option in the rule editing area.

在本实施例中,当待选项为条件配置项时,完成选择操作以后,调用浏览器APIexecCommand('insertHTML'),将输入的条件配置项替换为具有预设样式的HTML代码,从而在规则编辑区100中显示具有预设图形的条件配置项。In this embodiment, when the option to be selected is a conditional configuration item, after completing the selection operation, the browser APIexecCommand('insertHTML') is called to replace the input conditional configuration item with HTML code with a preset style, so as to edit the rule Condition configuration items with preset graphics are displayed in the area 100 .

本实施例所述生成规则表达式的方法,用户可以直接在规则编辑区100的输入框中以输入的方式快捷选中已有条件配置项和规则组成符,避免输错其他不存在的条件配置项和规则组成符;通过使规则编辑区100条件配置项与条件编辑区中配置条件的图形相同,将两个功能区域中的条件序号视觉样式的统一,增强两部分的关联关系,降低用户的理解成本;在条件配置项的条件序号时,直接匹配已有序号的样式,保持简单输入操作的同时增强了用户对功能的理解。In the method for generating a rule expression described in this embodiment, the user can directly select the existing conditional configuration items and rule components by inputting them in the input box of the rule editing area 100, so as to avoid mistyping other non-existing conditional configuration items and rule components; by making the condition configuration items in the rule editing area 100 the same as the graphics of the configuration conditions in the condition editing area, the visual styles of the condition serial numbers in the two functional areas are unified, the relationship between the two parts is enhanced, and the user's understanding is reduced. Cost; when the conditional serial number of the conditional configuration item is used, it directly matches the style of the serial number, which enhances the user's understanding of the function while maintaining the simple input operation.

在一些实施例中,所述方法还包括:In some embodiments, the method further includes:

步骤S201,基于预设的校验规则对所述规则表达式进行校验,获得校验结果。Step S201, verifying the regular expression based on a preset verification rule to obtain a verification result.

本实施例中,用户在规则编辑区100中的输入完成后,即规则编辑区100失去焦点以后,采用预设的校验规则对规则编辑区100中的规则表达式进行校验从而获得校验结果。In this embodiment, after the user's input in the rule editing area 100 is completed, that is, after the rule editing area 100 loses focus, a preset verification rule is used to verify the rule expression in the rule editing area 100 to obtain the verification result.

具体的,可将规则表达式的字符串解析为token进行校验。校验规则包括:校验token中括弧是否闭合、校验规则组成符左右两边是否为条件配置项、校验条件配置项是否在条件配置区中等。Specifically, the string of the regular expression can be parsed into a token for verification. The verification rules include: verifying whether the brackets in the token are closed, verifying whether the left and right sides of the rule component are conditional configuration items, and verifying whether the conditional configuration items are in the conditional configuration area, etc.

步骤S203,响应于所述规则表达式的校验结果为错,以第二标记状态标记所述规则表达式中错误的所述条件配置项和/或所述规则组成符。Step S203, in response to the verification result of the regular expression being an error, mark the incorrect condition configuration item and/or the rule component in the regular expression with a second marking state.

当规则表达式的校验结果有错误时,基于以第二标记状态标记所述规则表达式中错误的所述条件配置项和/或所述规则组成符,从而便于用户查看错误的内容。When there is an error in the verification result of the regular expression, based on the conditional configuration item and/or the rule composition character that is marked with the second marking state as an error in the regular expression, it is convenient for the user to view the content of the error.

如图6a所示,当规则表达式中缺少一半括弧时,采用第二标记状态标记另一半括弧,并提示“请补充完整的()”。As shown in Figure 6a, when a half bracket is missing in the regular expression, the second mark state is used to mark the other half bracket, and a prompt "please complete ()" is displayed.

如图6b所示,当输入错误的规则组成符ooor时,采用第二标记状态标记错误的规则组成符ooor,并提示“仅支持输入已有规则组成符and、or、(、)”。As shown in Figure 6b, when an incorrect rule composition symbol ooor is input, the second marking state is used to mark the incorrect rule composition symbol ooor, and a prompt "Only supports input of existing rule composition symbols and, or, (,)".

如图6c所示,当规则组成符and的右侧缺少条件配置项时,采用第二标记状态标记该规则组成符and,并提示“规则组成符前后缺少条件配置项”。As shown in Fig. 6c, when the right side of the rule component and lacks a condition configuration item, the second mark state is used to mark the rule component and, and prompt "the rule component lacks a condition configuration item before and after the rule component".

如图6d所示,当条件配置项①⑩之间不具有规则组成符时,采用第二标记状态标记条件配置项①⑩,并提示“条件配置项之间缺失规则组成符”。As shown in Figure 6d, when there is no rule component between the conditional configuration items ①⑩, the second mark state is used to mark the conditional configuration item ①⑩, and prompts "the rule component is missing between the conditional configuration items".

其中,第二标记状态可以为高亮、加粗、下划线、阴影、不同颜色等标记状态,本实施例对此不作限制。The second marking state may be a marking state such as highlight, bold, underline, shadow, and different colors, which is not limited in this embodiment.

本实施例中,通过对规则编辑区100中规则表达式的校验与标记,能够帮助用户快速定位错误信息,降低操作成本。In this embodiment, by checking and marking the rule expression in the rule editing area 100, it can help the user to quickly locate the error information and reduce the operation cost.

需要说明的是,本公开实施例的方法可以由单个设备执行,例如一台计算机或服务器等。本实施例的方法也可以应用于分布式场景下,由多台设备相互配合来完成。在这种分布式场景的情况下,这多台设备中的一台设备可以只执行本公开实施例的方法中的某一个或多个步骤,这多台设备相互之间会进行交互以完成所述的方法。It should be noted that, the methods of the embodiments of the present disclosure may be executed by a single device, such as a computer or a server. The method in this embodiment can also be applied in a distributed scenario, and is completed by the cooperation of multiple devices. In the case of such a distributed scenario, one device among the multiple devices may only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete all the steps. method described.

需要说明的是,上述对本公开的一些实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于上述实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。It should be noted that some embodiments of the present disclosure are described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the above-described embodiments and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

基于同一发明构思,与上述任意实施例方法相对应的,本公开还提供了一种生成规则表达式的装置。Based on the same inventive concept, and corresponding to the method in any of the above embodiments, the present disclosure also provides an apparatus for generating a regular expression.

参考图7,所述装置,包括:Referring to Figure 7, the device includes:

生成模块11,被配置为:响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,并在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项。The generating module 11 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 component and/or condition configuration items matching the input content in the selection list.

显示模块13,被配置为:响应于针对所述规则编辑区的输入完成操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项以生成规则表达式。其中,所述选择列表中所述条件配置项基于预设的配置条件获得,所述规则编辑区显示的所述条件配置项的预设图形与所述配置条件的图形相同。The display module 13 is configured to: in response to the input completion operation for the rule editing area, display the rule component and/or the condition configuration item with a preset graphic 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 graph of the condition configuration item displayed in the rule editing area is the same as the graph of the configuration condition.

在一些实施例中,所述生成模块11,还用于实现:获取所述规则编辑区的焦点事件,确定光标在所述规则编辑区中的位置信息,基于所述位置信息生成所述选择列表。In some embodiments, the generating module 11 is further configured to: acquire the focus event of the rule editing area, determine the position information of the cursor in the rule editing area, and generate the selection list based on the position information .

在一些实施例中,所述生成模块11,还用于实现:监听所述规则编辑区的内容变化事件,获取所述输入内容。In some embodiments, the generating module 11 is further configured to: monitor a content change event in the rule editing area, and obtain the input content.

在一些实施例中,所述生成模块11,还用于实现:In some embodiments, the generating module 11 is further configured to implement:

响应于所述输入内容包括所述条件配置项,在所述选择列表中显示具有预设图形的所述条件配置项;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 component, displaying all the rule components including the at least part of the characters in the selection list.

在一些实施例中,所述生成模块11,还用于实现:响应于所述输入内容为空,在所述选择列表中显示具有预设图形的全部所述条件配置项及全部所述规则组成符。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 with preset graphics and all the rule components in the selection list symbol.

在一些实施例中,所述显示模块11,还用于实现:在所述选择列表中以第一标记状态标记一个所述条件配置项或所述规则组成符;In some embodiments, the display module 11 is further configured to: mark one of the condition configuration items or the rule component in the selection list with a first mark state;

响应于对处于所述第一标记状态的所述条件配置项或所述规则组成符的选择操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项。In response to a selection operation on the condition configuration item or the rule component in the first marked state, displaying the rule component and/or the condition with a preset graphic in the rule editing area configuration item.

在一些实施例中,所述装置,还用于实现:基于预设的校验规则对所述规则表达式进行校验,获得校验结果;In some embodiments, the apparatus is further configured to: verify the regular expression based on a preset verification rule, and obtain a verification result;

响应于所述规则表达式的校验结果为错,以第二标记状态标记所述规则表达式中错误的所述条件配置项和/或所述规则组成符。In response to the verification result of the regular expression being an error, the conditional configuration item and/or the rule component element that are in error in the regular expression are marked with a second marking state.

为了描述的方便,描述以上装置时以功能分为各种模块分别描述。当然,在实施本公开时可以把各模块的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, when describing the above device, the functions are divided into various modules and described respectively. Of course, when implementing the present disclosure, the functions of each module may be implemented in one or more software and/or hardware.

上述实施例的装置用于实现前述任一实施例中相应的生成规则表达式的方法,并且具有相应的方法实施例的有益效果,在此不再赘述。The apparatus in the above embodiment is used to implement the corresponding method for generating a regular expression in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

基于同一发明构思,与上述任意实施例方法相对应的,本公开还提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上任意一实施例所述的方法。Based on the same inventive concept and corresponding to any of the above-mentioned embodiments, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, the processor The method described in any one of the above embodiments is implemented when the program is executed.

图8示出了本实施例所提供的一种更为具体的电子设备硬件结构示意图,该设备可以包括:处理器1010、存储器1020、输入/输出接口1030、通信接口1040和总线1050。其中处理器1010、存储器1020、输入/输出接口1030和通信接口1040通过总线1050实现彼此之间在设备内部的通信连接。FIG. 8 shows a schematic diagram of 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 realize the communication connection among each other within the device through the bus 1050 .

处理器1010可以采用通用的CPU(Central Processing Unit,中央处理器)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本说明书实施例所提供的技术方案。The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit, central processing unit), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute related program to implement the technical solutions provided by the embodiments of this specification.

存储器1020可以采用ROM(Read Only Memory,只读存储器)、RAM(Random AccessMemory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器1020可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器1020中,并由处理器1010来调用执行。The memory 1020 may be implemented in the form of a ROM (Read Only Memory, read only memory), a RAM (Random Access Memory, random access memory), a static storage device, a dynamic storage device, and the like. The memory 1020 may store an operating system and other application programs. When implementing the technical solutions provided by the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1020 and invoked by the processor 1010 for execution.

输入/输出接口1030用于连接输入/输出模块,以实现信息输入及输出。输入输出/模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包括显示器、扬声器、振动器、指示灯等。The input/output interface 1030 is used to connect the input/output module to realize information input and output. The input/output/module can be configured in the device as a component (not shown in the figure), or can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, and the like.

通信接口1040用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。The communication interface 1040 is used to connect a communication module (not shown in the figure), so as to realize the communication interaction between the device and other devices. The communication module may implement communication through wired means (eg, USB, network cable, etc.), or may implement communication through wireless means (eg, mobile network, WIFI, Bluetooth, etc.).

总线1050包括一通路,在设备的各个组件(例如处理器1010、存储器1020、输入/输出接口1030和通信接口1040)之间传输信息。Bus 1050 includes a path to transfer information between the various components of the device (eg, processor 1010, memory 1020, input/output interface 1030, and communication interface 1040).

需要说明的是,尽管上述设备仅示出了处理器1010、存储器1020、输入/输出接口1030、通信接口1040以及总线1050,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本说明书实施例方案所必需的组件,而不必包含图中所示的全部组件。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 the specific implementation process, the device may also include necessary components for normal operation. other components. In addition, those skilled in the art can understand that, the above-mentioned device may only include components necessary to implement the solutions of the embodiments of the present specification, rather than all the components shown in the figures.

上述实施例的电子设备用于实现前述任一实施例中相应的方法,并且具有相应的方法实施例的有益效果,在此不再赘述。The electronic device in the foregoing 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 will not be repeated here.

基于同一发明构思,与上述任意实施例方法相对应的,本公开还提供了一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行如上任一实施例所述的方法。Based on the same inventive concept and corresponding to any of the above-mentioned embodiments, the present disclosure also provides a non-transitory computer-readable storage medium, where the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions use to cause the computer to perform the method as described in any of the above embodiments.

本实施例的计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。The computer readable medium of this embodiment includes both persistent and non-permanent, removable and non-removable media and can be implemented by any method or technology for information storage. Information may be computer readable instructions, data structures, modules of programs, 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 Disc (DVD) or other optical storage, Magnetic tape cartridges, 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 embodiments are used to cause 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.

所属领域的普通技术人员应当理解:以上任何实施例的讨论仅为示例性的,并非旨在暗示本公开的范围(包括权利要求)被限于这些例子;在本公开的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,步骤可以以任意顺序实现,并存在如上所述的本公开实施例的不同方面的许多其它变化,为了简明它们没有在细节中提供。It should be understood by those of ordinary skill in the art that the discussion of any of the above embodiments is only exemplary, and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples; under the spirit of the present disclosure, the above embodiments or Technical features in different embodiments may also be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the disclosed embodiments as described above, which are not provided in detail for the sake of brevity.

另外,为简化说明和讨论,并且为了不会使本公开实施例难以理解,在所提供的附图中可以示出或可以不示出与集成电路(IC)芯片和其它部件的公知的电源/接地连接。此外,可以以框图的形式示出装置,以便避免使本公开实施例难以理解,并且这也考虑了以下事实,即关于这些框图装置的实施方式的细节是高度取决于将要实施本公开实施例的平台的(即,这些细节应当完全处于本领域技术人员的理解范围内)。在阐述了具体细节(例如,电路)以描述本公开的示例性实施例的情况下,对本领域技术人员来说显而易见的是,可以在没有这些具体细节的情况下或者这些具体细节有变化的情况下实施本公开实施例。因此,这些描述应被认为是说明性的而不是限制性的。In addition, to simplify illustration and discussion, and in order not to obscure the embodiments of the present disclosure, well-known power/power sources associated with integrated circuit (IC) chips and other components may or may not be shown in the figures provided in the figures provided. ground connection. Furthermore, devices may be shown in block diagram form in order to avoid obscuring the disclosed embodiments, and this also takes into account the fact that details regarding the implementation of these block diagram devices are highly dependent on the implementation of the disclosed embodiments platform (ie, these details should be well within the understanding of those skilled in the art). Where specific details (eg, circuits) are set forth to describe exemplary embodiments of the present disclosure, it will be apparent to those skilled in the art that these specific details may be made without or with changes The embodiments of the present disclosure are implemented as follows. Accordingly, these descriptions are to be considered illustrative rather than restrictive.

尽管已经结合了本公开的具体实施例对本公开进行了描述,但是根据前面的描述,这些实施例的很多替换、修改和变型对本领域普通技术人员来说将是显而易见的。例如,其它存储器架构(例如,动态RAM(DRAM))可以使用所讨论的实施例。Although the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations to these embodiments will be apparent to those of ordinary skill in the art from the foregoing description. For example, other memory architectures (eg, dynamic RAM (DRAM)) may use the discussed embodiments.

本公开实施例旨在涵盖落入所附权利要求的宽泛范围之内的所有这样的替换、修改和变型。因此,凡在本公开实施例的精神和原则之内,所做的任何省略、修改、等同替换、改进等,均应包含在本公开的保护范围之内。The disclosed embodiments are intended to cover all such alternatives, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omission, modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present disclosure should be included within the protection scope of the present disclosure.

Claims (10)

1.一种生成规则表达式的方法,其特征在于,包括:1. a method for generating a regular expression, is characterized in that, comprises: 响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,并在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项;In response to an input operation for the rule editing area, a selection list is generated based on the input content, and a rule component and/or condition configuration item matching the input content is displayed in the selection list; 响应于针对所述规则编辑区的输入完成操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项以生成规则表达式;In response to the input completion operation for the rule editing area, displaying the rule component and/or the condition configuration item with a preset graphic 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 graph of the condition configuration item displayed in the rule editing area is the same as the graph of the configuration condition. 2.根据权利要求1所述的方法,其特征在于,所述响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,包括:2. The method according to claim 1, wherein the generating a selection list based on the input content in response to an input operation for the rule editing area, comprising: 获取所述规则编辑区的焦点事件,确定光标在所述规则编辑区中的位置信息,基于所述位置信息生成所述选择列表。The focus event of the rule editing area is acquired, the position information of the cursor in the rule editing area is determined, and the selection list is generated based on the position information. 3.根据权利要求1所述的方法,其特征在于,所述在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项,包括:3. The method according to claim 1, wherein the displaying in the selection list the rule components and/or condition configuration items that match the input content, comprises: 响应于所述输入内容包括所述条件配置项,在所述选择列表中显示具有预设图形的所述条件配置项;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 component, displaying all the rule components including the at least part of the characters in the selection list. 4.根据权利要求1所述的方法,其特征在于,所述在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项,还包括:4. The method according to claim 1, wherein the displaying in the selection list the rule components and/or condition configuration items that match the input content, further comprises: 响应于所述输入内容为空,在所述选择列表中显示具有预设图形的全部所述条件配置项及全部所述规则组成符。In response to the input content being empty, all the condition configuration items with preset graphics and all the rule components are displayed in the selection list. 5.根据权利要求3或4所述的方法,其特征在于,还包括:5. The method according to claim 3 or 4, characterized in that, further comprising: 在所述选择列表中以第一标记状态标记一个所述条件配置项或所述规则组成符;Marking one of the condition configuration items or the rule component in the selection list with the first marked state; 响应于对处于所述第一标记状态的所述条件配置项或所述规则组成符的选择操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项。In response to a selection operation on the condition configuration item or the rule component in the first marked state, displaying the rule component and/or the condition with a preset graphic in the rule editing area configuration item. 6.根据权利要求1所述的方法,其特征在于,还包括:6. The method of claim 1, further comprising: 基于预设的校验规则对所述规则表达式进行校验,获得校验结果;Verifying the regular expression based on a preset verification rule to obtain a verification result; 响应于所述规则表达式的校验结果为错,以第二标记状态标记所述规则表达式中错误的所述条件配置项和/或所述规则组成符。In response to the verification result of the regular expression being an error, the conditional configuration item and/or the rule component element that are in error in the regular expression are marked with a second marking state. 7.一种生成规则表达式的装置,其特征在于,包括:7. A device for generating regular expressions, comprising: 生成模块,被配置为:响应于针对规则编辑区的输入操作,基于输入内容生成选择列表,并在所述选择列表中显示与所述输入内容匹配的规则组成符和/或条件配置项;A generating module, configured to: in response to an input operation for the rule editing area, generate a selection list based on the input content, and display the rule component and/or condition configuration item matching the input content in the selection list; 显示模块,被配置为:响应于针对所述规则编辑区的输入完成操作,在所述规则编辑区中显示所述规则组成符和/或具有预设图形的所述条件配置项以生成规则表达式;A display module, configured to: in response to an input completion operation for 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 Mode; 其中,所述选择列表中所述条件配置项基于预设的配置条件获得,所述规则编辑区显示的所述条件配置项的预设图形与所述配置条件的图形相同。Wherein, the condition configuration item in the selection list is obtained based on a preset configuration condition, and the preset graph of the condition configuration item displayed in the rule editing area is the same as the graph of the configuration condition. 8.根据权利要求7所述的装置,其特征在于,所述生成模块,还被配置为:8. The apparatus according to claim 7, wherein the generating module is further configured to: 响应于所述输入内容包括所述条件配置项,在所述选择列表中显示具有预设图形的所述条件配置项;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 component, displaying all the rule components including the at least part of the characters in the selection list. 9.一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如权利要求1至6任意一项所述的方法。9. An electronic device, comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements any one of claims 1 to 6 when the processor executes the program method described in item. 10.一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,其特征在于,所述计算机指令用于使所述计算机执行权利要求1至6任一所述的方法。10. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute any one of claims 1 to 6. method described.
CN202210658977.7A 2022-06-09 2022-06-09 Method and device for generating regular expression, electronic equipment and storage medium Pending CN115080022A (en)

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)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408682A (en) * 2018-10-30 2019-03-01 杭州安恒信息技术股份有限公司 A kind of method of regular expression matching, system and equipment
CN109766483A (en) * 2018-12-28 2019-05-17 平安科技(深圳)有限公司 Regular expression generation method, device, computer equipment and storage medium
CN110045953A (en) * 2019-04-22 2019-07-23 第四范式(北京)技术有限公司 Generate the method and computing device of business rule expression formula
CN110187874A (en) * 2019-05-13 2019-08-30 第四范式(北京)技术有限公司 A kind of regular configuration method executed in computer equipment and device
CN112328347A (en) * 2020-11-05 2021-02-05 杭州大搜车汽车服务有限公司 Application rule configuration method and device and page processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408682A (en) * 2018-10-30 2019-03-01 杭州安恒信息技术股份有限公司 A kind of method of regular expression matching, system and equipment
CN109766483A (en) * 2018-12-28 2019-05-17 平安科技(深圳)有限公司 Regular expression generation method, device, computer equipment and storage medium
CN110045953A (en) * 2019-04-22 2019-07-23 第四范式(北京)技术有限公司 Generate the method and computing device of business rule expression formula
CN110187874A (en) * 2019-05-13 2019-08-30 第四范式(北京)技术有限公司 A kind of regular configuration method executed in computer equipment and device
CN112328347A (en) * 2020-11-05 2021-02-05 杭州大搜车汽车服务有限公司 Application rule configuration method and device and page processing method

Similar Documents

Publication Publication Date Title
JP7017613B2 (en) Naming Robotic Process Automation activities based on auto-discovered target labels
CN111177176B (en) Data detection method, device and storage medium
US10592211B2 (en) Generation of application behaviors
CN102609403B (en) Formatting data by example
US20170192877A1 (en) Mobile application development and deployment
CN112307408B (en) Method and device for determining element information in page, electronic equipment and storage medium
CN111813409A (en) A code generation method, device, device and storage medium for an interactive interface
US7610548B1 (en) Method and apparatus for applying locale behaviors to regions of a form
CN104123091A (en) Character input apparatus and method, and program
CN112667218A (en) Processing method, device, equipment and storage medium
CN101542585A (en) Image generation system, projector, program, information storage medium, and image generation method
CN110597579A (en) Android system-based custom control generation method, apparatus, device and medium
Moore Mastering GUI programming with Python: Develop impressive cross-platform GUI applications with Pyqt
Harris HTML5 and CSS3 All-in-one for Dummies
JP6755538B1 (en) Execution program, input support program, and code-reading robot
CN113139371A (en) Visual chart construction method, device and system and storage medium
CN115080022A (en) Method and device for generating regular expression, electronic equipment and storage medium
CN111240676A (en) Method and device for generating code of skeleton screen
CN115081423A (en) Document editing method, device, electronic device and storage medium
CN111459483B (en) Interface processing method and device
CN116820463A (en) Canvas-based page display methods, devices, equipment and media
CN111475156B (en) Page code generation method and device, electronic equipment and storage medium
CN115525270A (en) Method, system, terminal device and storage medium for rendering form pages based on drag and drop
CN115629828A (en) State machine display method, device and medium
US10101880B2 (en) Tools on-demand

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