标签搜索正则表达式

时间:2018-01-28 10:01:28

标签: regex

问题:查找所有的标签并将其列在sometags中的文本(如果有的话)

sometag的模式:

Info about Leela <sometag xml:lang="en" lang="en"><b><sometag>Turanga Leela
</sometag></b></sometag><sometag>Super</sometag><sometag>girl</sometag>

text1,text2可能为空

实施例

<sometag([\w\d\s:=\"<>]+)?<\/sometag>(<\/b>)?(<\/sometag>)?

我的解决方案:

<sometag xml:lang="en" lang="en"><b><sometag>Turanga Leela
</sometag></b></sometag>

结果:

  1. <sometag>Super</sometag>
  2. <sometag>girl</sometag>
  3. #: import Utils kivy.utils BoxLayout: spacing: 0 padding: 0 canvas: Color: rgb: Utils.get_color_from_hex("#1b262d")[:3] Rectangle: size: self.size TabbedPanel: do_default_tab: False tab_width: self.size[0] / 2 canvas: Color: rgb: Utils.get_color_from_hex("#00ff00")[:3] Rectangle: size: self.size TabbedPanelItem: background_color: Utils.get_color_from_hex("#1b262d") text: "PAST" background_down: "" background_normal: "" BoxLayout: orientation: "vertical" canvas: Color: rgb: Utils.get_color_from_hex("#1b262d")[:3] Rectangle: size: self.size pos: self.pos BoxLayout: padding: [10, 12, 10, 12] spacing: 5 size_hint_y: 0.1 TextInput: background_color: Utils.get_color_from_hex("#303E46") foreground_color: [1, 1, 1, 1] size_hint_x: 0.2 padding: [10, ( self.height - self.line_height ) / 2] text: "DATES" TextInput: size_hint_x: 0.15 padding: [10, ( self.height - self.line_height ) / 2] text: "TEST" TextInput: size_hint_x: 0.2 padding: [10, ( self.height - self.line_height ) / 2] text: "CAT" TextInput: size_hint_x: 0.15 padding: [10, ( self.height - self.line_height ) / 2] text: "SORT BY" TextInput: size_hint_x: 0.15 padding: [10, ( self.height - self.line_height ) / 2] text: "SHOW ONLY" TextInput: size_hint_x: 0.15 padding: [10, ( self.height - self.line_height ) / 2] text: "SEARCH" BoxLayout: size_hint_y: 0.8 spacing: 10 padding: 10 orientation: "horizontal" canvas: Color: rgb: Utils.get_color_from_hex("#303E46")[:3] Rectangle: size: self.size pos: self.pos Button: size_hint_x: 0.7 text: "TEST" Button: size_hint_x: 0.3 text: "TESTS" TabbedPanelItem: background_color: Utils.get_color_from_hex("#303E46") text: "UPCOMING" background_down: "" background_normal: ""
  4. 问/关注:

    为什么不&lt; Sometag&gt; Turanga Leela &LT; / sometag&GT;出现?

0 个答案:

没有答案