我正在寻找一种方法来将Scala中的字符串拆分为带有组的正则表达式。
例如,用一个前面没有反斜杠的点分割。我试过用
"[^\\\\]\\."r.split("a.b.c\.d.e)
但它包含了前一个不是点字符的字符串。
Expected: a,b,c,c\.d,e
Result: , , c\., e
答案 0 :(得分:2)
您可以使用正则表达式negative lookbehind排除任何<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HighTech Auto Sales</title>
<link href="mainCSS.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="header">
<a itemprop="url" class="aselink" href="http://www.ase.com/Landing-Pages/Car-Owners/Find-a-Repair-Shop/Shop-Locator.aspx?Address=19111&d=75&sc=us">
<img class="aseimg" src="../Index%20Images/ASE_large.png"></a>
<a itemprop="url" class="NADAlogolink" href="http://www.niada.com/member_directory.php?te_mode=map_view">
<img class="NADAlogo" src="../Index%20Images/NADAlogo.png"></a>
<a itemprop="url" class="if_facebook_834722">
<img class="if_facebook_834722" src="../Index%20Images/if_facebook_834722.png"></a>
<img class="_5_Stars" src="../Index Images/5stars_small.png">
</div>
<nav>
<ul>
<li><a href="inventory.html">Our Inventory</a></li>
<li><a href="services.html">Superior Services</a></li>
<li><a href="blog.html">HighTech Blog</a></li>
<li><a href="contact.html">Contact & Location</a></li>
</ul>
</nav>
</body>
</html>
与之前的.
匹配,如下所示“:
\