相关疑难解决方法(0)

除了XHTML自包含标记之外,RegEx匹配开放标记

我需要匹配所有这些开始标记:

<p>
<a href="foo">
Run Code Online (Sandbox Code Playgroud)

但不是这些:

<br />
<hr class="foo" />
Run Code Online (Sandbox Code Playgroud)

我想出了这个,并希望确保我做对了.我只抓住了a-z.

<([a-z]+) *[^/]*?>
Run Code Online (Sandbox Code Playgroud)

我相信它说:

  • 找一个小于,然后
  • 然后,查找(并捕获)az一次或多次
  • 然后找到零个或多个空格
  • 找到任何字符零次或多次,贪婪/,然后
  • 找到一个大于

我有这个权利吗?更重要的是,你怎么看?

html regex xhtml

1323
推荐指数
36
解决办法
270万
查看次数

如何使用javascript或jquery删除多余的空格?

我得到HTML元素包含这个:

  <!--Product Style-->  <div style="float: right; padding-top: 4px; padding-bottom: 5px;">  P6C245RO </div>  <div style="text-transform: uppercase; font-weight: bold; padding-top: 4px; padding-bottom: 5px;">  Style </div>  <div style="clear: both; border-top: 1px solid rgb(216, 216, 216); padding-top: 4px;">  <!--Product Description-->  <div style="font-size: 11px ! important;"></div>  <div style="background: url(&quot;http://ii.armaniexchange.com/ArmaniExchange/images/en_US/global/globalgraphics/bullet.gif&quot;) no-repeat scroll 0pt 4px transparent; padding-left: 12px;">fine tonal striped fabric</div>  <div style="background: url(&quot;http://ii.armaniexchange.com/ArmaniExchange/images/en_US/global/globalgraphics/bullet.gif&quot;) no-repeat scroll 0pt 4px transparent; padding-left: 12px;">epaulettes and sleeve tab</div>  <div style="background: url(&quot;http://ii.armaniexchange.com/ArmaniExchange/images/en_US/global/globalgraphics/bullet.gif&quot;) no-repeat scroll 0pt 4px transparent; padding-left: 12px;">metal logo plate on …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

26
推荐指数
2
解决办法
4万
查看次数

标签 统计

html ×2

javascript ×1

jquery ×1

regex ×1

xhtml ×1