RegEx in VBE code editor

  • Thread starter Thread starter R Avery
  • Start date Start date
R

R Avery

Is there any addin which would enable this capability? I so often find
myself in positions where a regex would do just the trick.
 
Hi
as an example (validation of email addresses):
Public Function ValidateEmail(MailAddress As String) As Boolean
Dim oRegExp As Object
Set oRegExp = CreateObject("VBScript.RegExp")
With oRegExp
.Pattern = "^\w+((-\w+)|(\.\w+))*\@\w+((\.|-) \w+) *\.\w+$"
ValidateEmail = .Test(MailAddress)
End With
End Function
 
I'm sorry, I was not clear enough. I am familiar with using RegEx in VB
functions, but the VBE Search and Replace form supports wildcards, but
not RegEx. Is there a VBE Extensibility addin that enables RegEx search
and replace in the code editor. Typical examples would be: I have a
function with like 50 lines of var1 = cells(1,1).value, var2 =
cells(2,1).value, etc, and I would like to reverse the equality so that
it instead reads cells(1,1).value = var1, cells(2,1).value = var2.

As far as i know, things like this cannot be done using wildcards.
 
I think you would need to export it to a text editor like Textpad and do it
there.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top