Reputation: 21
Working with VBScript and Regex, and I will readily admit that I'm a rookie with regex, but do understand it's power and potential.
What I want to return without leading/trailing spaces:
how are you today
Here's an example of variations of input strings:
Me and you are here-how are you today
Me and you are here- how are you today
Me and you are here -how are you today
Me and you are here - how are you today
Me and you are here- how are you today-very well
Me and you are here- how are you today- very well
Me and you are here- how are you today -very well
Me and you are here- how are you today - very well
Me and you are here -how are you today-very well
Me and you are here -how are you today- very well
Me and you are here -how are you today -very well
Me and you are here -how are you today - very well
Me and you are here-how are you today-very well
Me and you are here-how are you today- very well
Me and you are here-how are you today -very well
Me and you are here-how are you today - very well
Me and you are here - how are you today-very well
Me and you are here - how are you today- very well
Me and you are here - how are you today -very well
Me and you are here - how are you today - very well
Edited to add additional variants of all the above with additional hyphens after the phrase 'very well'. Example:
Me and you are here - how are you today -very well - good - and you -
Me and you are here - how are you today - very well - good
Here's the pattern I'm working with so far, however it's not quite there:
(?<=\-)(.*?)(?=\-|\z)
Upvotes: 0
Views: 86
Reputation: 21
The below worked for what I needed. Thanks for the help!
arrSubjectSplit = Split(objMessage.Subject,"-")
strCustomerName = Trim(arrSubjectSplit(1))
Upvotes: 1