<section data-ng-controller="CustomersController" data-ng-init="findOne()">
<div class="page-header">
<h1 data-ng-bind="customer.name"></h1>
</div>
<div class="pull-right" data-ng-show="((authentication.user) && (authentication.user._id == customer.user._id))">
<a class="btn btn-primary" href="/#!/customers/{{customer._id}}/edit">
<i class="glyphicon glyphicon-edit"></i>
</a>
<a class="btn btn-primary" href="/#!/customer-users/{{customer._id}}/create">
<i class="glyphicon glyphicon-user"></i>
<i class="glyphicon glyphicon-plus"></i>
</a>
<!-- <a class="btn btn-default btn-danger" data-ng-click="remove();">
<i class="glyphicon glyphicon-trash"></i>
</a> -->
</div>
<small>
<em class="text-muted">
Added on
<span data-ng-bind="customer.created | date:'mediumDate'"></span>
by
<span data-ng-bind="customer.user.displayName"></span>
</em>
</small>
<br /><br /><br />
<div class="list-group">
<div data-ng-repeat="customerUser in customerUsers" class="list-group-item">
<h4 class="list-group-item-heading">
{{customerUser.user.displayName}}
hello
<small class="label label-default" ng-show="customerUser.admin">admin</small>
</h4>
</div>
</div>
</section>
我的PHP数组中有一些这些元素,我需要提取除了以外的所有元素:
[17] => Link_Info-mc1.7.10-0.3.1.litemod
[18] => Mantle-1.7.10-0.3.2.jar
[19] => MicdoodleCore-1.7-3.0.11.333.jar
[20] => MineTweaker3-1.7.10-3.0.9C.jar
[21] => ModTweaker 2-0.8.0.jar
[22] => MouseTweaks-2.4.4-mc1.7.10.jar
[23] => NEIIntegration-MC1.7.10-1.0.9.jar
[24] => NotEnoughItems-1.7.10-1.0.5.110-universal.jar
所以我尝试使用这样的正则表达式:
-1.7.10-1.0.5.110-universal.jar
但它仅从字符串中提取modname,例如 2-0.8.0.jar 。
所以我需要让它更灵活。
答案 0 :(得分:1)
如果我理解正确,您希望匹配除包含&#39; universal&#39;的文件名以外的所有文件名。要做到这一点,你可以使用负面的lookbehind与这样的模式:
/[\w\d\-|\._ ]*(?:(?<!universal)(\.jar)|(\.litemod))/
DEMO:https://regex101.com/r/mI2fM8/3
如果您只想匹配名称(没有版本号,......),这样就足够了:
/^[^\- ]+/