RegEx to extract email

后端 未结 4 1752
花落未央
花落未央 2021-01-15 04:52

I need to extract only the email from a spreadsheet in Excel. I\'ve found some example VBA code here at this StackOverflow link, courtesy of Portland Runner

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-15 05:15

    When You return strInput You just get the same string as the input. You need to return Value that has been found using RegExp.

    Try

    Set matches = regEx.Execute(strInput)
    simpleCellRegex = matches(1).Value
    

    Instead of

    simpleCellRegex = regEx.Replace(strInput, strReplace)
    

提交回复
热议问题