ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RegEx in VBE code editor (https://www.excelbanter.com/excel-programming/319310-regex-vbe-code-editor.html)

R Avery

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.

Frank Kabel

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.




Tom Ogilvy

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.




R Avery

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.


Bob Phillips[_6_]

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.




Bernd Plumhoff

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

Tom Ogilvy

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.





All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com