-1

需要帮助构建检查三重 (|||) 和 || 的 VBScript 正则表达式 和 | 并给出输出例如:-

Contacts ||| ||Position: |PosH | |Pos Cust ||Name: |Name H | |Name Cust || 

a1:-Contacts,a2:||Position: |PosH | |Pos Cust ||Name: |Name H | |Name Cust || 
b1:-Position:, b2:-Name:
c1:PosH ,c2: ,c3:Pos Cust 
4

1 回答 1

1

只需使用拆分():

>> s = "Contacts ||| ||Position: |PosH | |Pos Cust ||Name: |Name H | |Name Cust ||"
>> a = Split(s, "|")
>> For i = 0 To UBound(a)
>>     WScript.Echo i, """" & a(i) & """"
>> Next
>>
0 "Contacts "
1 ""
2 ""
3 " "
4 ""
5 "Position: "
6 "PosH "
7 " "
8 "Pos Cust "
9 ""
10 "Name: "
11 "Name H "
12 " "
13 "Name Cust "
14 ""
15 ""
>> WScript.Echo "a1", """" & a(0) & """"
>> WScript.Echo "c3", """" & a(8) & """"
>>
a1 "Contacts "
c3 "Pos Cust "
>>

(并加入一些 Trim()s)

于 2013-10-23T18:28:29.203 回答