2013-02-08 29 views
0

我有一個網頁完全一樣的數字:搜索一個特殊號碼vb.net

xxxx.xxx.xxx.xxx[space]xx 

例如爲:

124.240.187.79 82 

如何搜索,並讓他們編程?

+0

使用正則表達式。 – 2013-02-08 22:39:29

+0

喜歡?這就是爲什麼我發佈這個問題的原因 – user2023328 2013-02-08 22:43:43

+0

我們不只是爲你做所有的想法。 [你自己試過什麼?](http://whathaveyoutried.com) – 2013-02-08 22:44:48

回答

0

regexp03.vbs:

Dim objRegExp : Set objRegExp = CreateObject("VBScript.RegExp") 
objRegExp.Global = True 
Dim input 
input = "I have a webpage full of numbers like: xxxx.xxx.xxx.xxx[space]xx E.g.: 124.240.187.79 82 How do I search and get them programatically?" 

Dim Pattern : Pattern = "[0-9]{3}\.[0-9]{3}\.[0-9]{3}\.[0-9]{2}\s[0-9]{2}" 
WScript.Echo "Pattern : " & Pattern 

objRegExp.Pattern = Pattern 

Set objMatches = objRegExp.Execute(input) 

For i=0 To objMatches.Count-1 
    Set objMatch = objMatches.Item(i) 
    WScript.Echo objMatch.Value 
Next 

命令行:

cscript //nologo regexp03.vbs 

輸出:

Pattern : [0-9]{3}\.[0-9]{3}\.[0-9]{3}\.[0-9]{2}\s[0-9]{2} 
124.240.187.79 82 
+0

這是一個vb6代碼? – user2023328 2013-02-08 22:58:18

+0

WSH,vbscript ... – STTR 2013-02-08 23:01:07

+0

好吧,我需要vb.net所以...謝謝,但它不是好東西 – user2023328 2013-02-08 23:32:19