Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default RegEx in VBE code editor

Is there any addin which would enable this capability? I so often find
myself in positions where a regex would do just the trick.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default RegEx in VBE code editor

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


--
Regards
Frank Kabel
Frankfurt, Germany
"R Avery" schrieb im Newsbeitrag
...
Is there any addin which would enable this capability? I so often find
myself in positions where a regex would do just the trick.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default RegEx in VBE code editor

http://msdn.microsoft.com/library/de...ting051099.asp

Can be called from VBA.

--
Regards,
Tom Ogilvy

"R Avery" wrote in message
...
Is there any addin which would enable this capability? I so often find
myself in positions where a regex would do just the trick.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default RegEx in VBE code editor

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.




Tom Ogilvy wrote:
http://msdn.microsoft.com/library/de...ting051099.asp

Can be called from VBA.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default RegEx in VBE code editor

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)


"R Avery" wrote in message
...
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.




Tom Ogilvy wrote:

http://msdn.microsoft.com/library/de...ting051099.asp

Can be called from VBA.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default RegEx in VBE code editor

I also missed RegEx sometimes.

Maybe Perl could be a solution when a workaround in VBA
seems to be too tedious:

http://support.microsoft.com/default.aspx?scid=kb;EN-
US;214797

Regards,
Bernd
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default RegEx in VBE code editor

Sorry, didn't read the subject - just the text.

--
Regards,
Tom Ogilvy

"R Avery" wrote in message
...
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.




Tom Ogilvy wrote:

http://msdn.microsoft.com/library/de...ting051099.asp

Can be called from VBA.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting Code in Visual Basic Editor (Excel 2003) Johnny S. NH Excel Worksheet Functions 1 August 30th 08 07:26 AM
Closing the VBA Editor using code Bony_Pony Excel Worksheet Functions 1 March 7th 05 08:14 PM
In Excel VBA Editor, how do I hide my code from other users? Mayberrk Excel Discussion (Misc queries) 1 February 8th 05 06:11 AM
printing module code from vba editor dirt Excel Programming 3 February 15th 04 10:02 PM
Regex Question William Barnes Excel Programming 5 January 2nd 04 11:57 AM


All times are GMT +1. The time now is 05:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"