c# - regex query implementation -
i trying check search box , query works has couple of problems.
// ================================= var check = new regex("[^a-za-z]"); match m = check.match(searchquery); if (m.equals(check) != true) { pnl_message.visible = true; pnl_message.cssclass = "messagetable"; lbl_message.text = " * letters allowed"; }
the if statement equals says suspicious comparing ! works! thing goes in if statement no matter set look too.
how should querying searchquery?
your equals
comparing match
regex
- they're different classes, it's never true, , go if
block.
you want if (m.success)
- checks whether value returned check.match(...)
successful match (i.e. input contained non-letter) or not.
c# asp.net regex
No comments:
Post a Comment