使用VBScript和Regex,我很乐意承认我是一个正则表达式的新手,但是要明白它的力量和潜力。
我想要返回没有前导/尾随空格:
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
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
编辑在“非常好”之后添加上述所有其他变体以及附加连字符。例如:
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
到目前为止,这是我正在使用的模式,但它并不完全存在:
(?<=\-)(.*?)(?=\-|\z)
答案 0 :(得分:1)
以下是我所需要的。谢谢你的帮助!
arrSubjectSplit = Split(objMessage.Subject,"-")
strCustomerName = Trim(arrSubjectSplit(1))