Skip to content
Snippets Groups Projects
Commit d7b206cc authored by Kegan Dougal's avatar Kegan Dougal
Browse files

Added basic RegExp support.

parent 06dfbdf7
No related branches found
No related tags found
No related merge requests found
...@@ -74,10 +74,8 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) { ...@@ -74,10 +74,8 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
// bing word list check // bing word list check
if (bingWords && !shouldBing) { if (bingWords && !shouldBing) {
for (var i=0; i<bingWords.length; i++) { for (var i=0; i<bingWords.length; i++) {
// TODO: Should really be a word check, not a string of characters check. var re = RegExp(bingWords[i]);
// E.g. bing word is "coffee", "I have coffee" = bing, "I am a coffeepot" = no bing if (content.search(re) != -1) {
// Currently it will bing for both.
if (content.indexOf(bingWords[i]) != -1) {
shouldBing = true; shouldBing = true;
break; break;
} }
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<div class="section"> <div class="section">
<h4>Additional words to alert on:</h4> <h4>Additional words to alert on:</h4>
<p>Leave blank to alert on all messages.</p> <p>Leave blank to alert on all messages.</p>
<input size=40 name="bingWords" ng-model="settings.bingWords" ng-list placeholder="Enter case-sensitive words separated with ," <input size=40 name="bingWords" ng-model="settings.bingWords" ng-list placeholder="Enter words separated with , (supports regex)"
ng-blur="saveBingWords()"/> ng-blur="saveBingWords()"/>
<ul> <ul>
<li ng-repeat="word in settings.bingWords">{{word}}</li> <li ng-repeat="word in settings.bingWords">{{word}}</li>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment