开发者

What exactly does VBScript's RegExp function do and what is the javascript equivalent?

I'm convert开发者_开发技巧ing something from VBScript to javascript which runs RegExp() on a textbox to check if it can be submitted and I wasn't sure exactly what it was doing.


It's a regular expression, which is used to check for patterns inside text. Most likely it's checking if the value inside the textbox is valid.

The JavaScript equivalent is also RegExp. This website has good regular expression information (for JavaScript, for VBScript). The syntax for the regular expression string itself is similar in both languages, but the syntax for creating and using a RegExp object is different.


They are quite similar, so you shouldn't have too much difficulty in porting the VBScript regex stuff to Javascript. These two links should be helpful:

  • Microsoft Beefs Up VBScript with Regular Expressions
  • Regular Expressions in JavaScript

the javascript oriented article has the available methods at the bottom of the article (about a third of the way down the page).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜