galileo
07-07-2009, 12:47 AM
Hey guys!
I got a rather straight forward question about the use of RegEx in VBA... My situation: The string (see above) needs to be split and each item, that includes the operators, should be stored into an seperate array item.
String:
[A_B_CCDE] 'Definition' + [A_B_OIED] 'Definition twowords' - [A_B_CDEF] 'Another Definition' %A [A_C_IOWS] 'Last Item Definition'
Match pattern:
\B\s(?=(?:\+|-|%A?|/|\*|COS|SIN))|\s(?=\[)
Result:
1 [A_B_CCDE] 'Definition'
2 +
3 [A_B_OIED] 'Definition twowords'
4 -
5 [A_C_IOWS] 'Last Item Definition'
So far so good. But how do I realize this in VBA using the Microsoft VBScript Regular Expressions 5.5 Lib? My knowledge stops at simple RegEx matches... is there a function for "split_with_regEx" ?
Thanks for your help!
André
I got a rather straight forward question about the use of RegEx in VBA... My situation: The string (see above) needs to be split and each item, that includes the operators, should be stored into an seperate array item.
String:
[A_B_CCDE] 'Definition' + [A_B_OIED] 'Definition twowords' - [A_B_CDEF] 'Another Definition' %A [A_C_IOWS] 'Last Item Definition'
Match pattern:
\B\s(?=(?:\+|-|%A?|/|\*|COS|SIN))|\s(?=\[)
Result:
1 [A_B_CCDE] 'Definition'
2 +
3 [A_B_OIED] 'Definition twowords'
4 -
5 [A_C_IOWS] 'Last Item Definition'
So far so good. But how do I realize this in VBA using the Microsoft VBScript Regular Expressions 5.5 Lib? My knowledge stops at simple RegEx matches... is there a function for "split_with_regEx" ?
Thanks for your help!
André