Skip to content

Commit 1ab8dbe

Browse files
author
Kurtis LoVerde
committed
optimized example regex
1 parent ec29132 commit 1ab8dbe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

demo.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
var cfg= new $.fn.RestrictedTextFieldConfig();
6060

6161
cfg.addType( "vowels", /^[aeiou]*$/, null );
62-
cfg.addType( "additionExpr", /^\d+\+\d+$/, /^\d+$|^\d+\+$/ );
62+
cfg.addType( "additionExpr", /^\d+\+\d+$/, /^\d+\+?$/ );
6363
}
6464

6565
function flashBorder( jqField, cssClass, times, delayMillis ) {
@@ -327,7 +327,7 @@ <h3>Complex type: mathematical expression</h3>
327327
<li>An integer</li>
328328
<li>An integer followed by a plus sign</li>
329329
</ul>
330-
<p>The regular expression for that is <code>/^\d+$|^\d+\+$</code>. Putting it all together, we get:</p>
330+
<p>The regular expression for that is <code>/^\d+\+?$/</code>. Putting it all together, we get:</p>
331331
<code>cfg.addType( "additionExpr", /^\d+\+\d+$/, /^\d+$|^\d+\+$/ );</code><br/><br/>
332332
<input type="text" id="txtAdditionExpr" />
333333
</div>

0 commit comments

Comments
 (0)