From: James Whitlow on 10 Jun 2010 08:45 "Evertjan." <exjxw.hannivoort(a)interxnl.net> wrote in message news:Xns9D937ACB6BD0Ceejj99(a)194.109.133.242... > Sometimees one wonders, > why the VBS regex is so much less readable than the Javascript equivalent: > > var temp, aURL= [ > "http://www.mysite.com/products.asp?prodID=12&catID=5&classID=322", > "http://www.mysite.com/products.asp?classID=7&prodID=9&classID=322", > "http://www.mysite.com/products.asp?prodID=180&catID=15&classID=322", > "http://www.mysite.com/products.asp?prodID=7" > ]; > > for (var i=0;i<aURL.length;i++) > if (temp = aURL[i].match(/(\?|\&)prodID=(\d+)/)) > alert( 'prodID\n\n' + temp[2] ); Indeed! That is much nicer looking code. I don't work with JavaScript, but in some of the examples I have seen I have really like how you can do your regular expression pattern declaration inline. I can only guess that VBScript cannot do this because regular expressions are not native to the language. I really wish they had at least taken this opportunity and used the extra time to fully implement them. There are many aspects of regular expressions that I have never used, but I have had a few instances in the past where I was quite annoyed that they could not perform 'lookbehind' matching.
First
|
Prev
|
Pages: 1 2 Prev: Creating a hyperlink withVB Script Next: PINGing a List of Servers Using VBScript |