ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems with Reg Pattern "[^"]\$[A-Z]*[0-9]" (https://www.excelbanter.com/excel-programming/411580-problems-reg-pattern-%5B%5E-%5D%5C%24%5B-z%5D%2A%5B0-9%5D.html)

ExcelMonkey

Problems with Reg Pattern "[^"]\$[A-Z]*[0-9]"
 
I am having a problem usng this regex pattern in VBA:

[^"]\$[A-Z]*[0-9]

When I put it into quotes:

"[^"]\$[A-Z]*[0-9]"

It highlights the first ] and says Invalid Character.

I am assuming that it has something to do with the way VBA uses quotes for
text strings. What do I have to do to get around this?

Thanks

EM

dougw

Problems with Reg Pattern "[^"]\$[A-Z]*[0-9]"
 

Not sure, but I think I read something about that before.... and they used
double quotes...

""[^\$[A-Z\*[0-9]""



"ExcelMonkey" wrote in message
...
I am having a problem usng this regex pattern in VBA:

[^"]\$[A-Z]*[0-9]

When I put it into quotes:

"[^"]\$[A-Z]*[0-9]"

It highlights the first ] and says Invalid Character.

I am assuming that it has something to do with the way VBA uses quotes for
text strings. What do I have to do to get around this?

Thanks

EM




Rick Rothstein \(MVP - VB\)[_2005_]

Problems with Reg Pattern "[^"]\$[A-Z]*[0-9]"
 
I do not work with RegEx myself (or at least I haven't for many, many years
now), but I think your problem is with the embedded quote mark. You must
double them up with inside a String constant (text with quote marks at the
beginning and end of the text). Try this pattern and see if it works...

"[^""]\$[A-Z]*[0-9]"

Rick


"ExcelMonkey" wrote in message
...
I am having a problem usng this regex pattern in VBA:

[^"]\$[A-Z]*[0-9]

When I put it into quotes:

"[^"]\$[A-Z]*[0-9]"

It highlights the first ] and says Invalid Character.

I am assuming that it has something to do with the way VBA uses quotes for
text strings. What do I have to do to get around this?

Thanks

EM



Ron Rosenfeld

Problems with Reg Pattern "[^"]\$[A-Z]*[0-9]"
 
On Tue, 27 May 2008 08:59:01 -0700, ExcelMonkey
wrote:

I am having a problem usng this regex pattern in VBA:

[^"]\$[A-Z]*[0-9]

When I put it into quotes:

"[^"]\$[A-Z]*[0-9]"

It highlights the first ] and says Invalid Character.

I am assuming that it has something to do with the way VBA uses quotes for
text strings. What do I have to do to get around this?

Thanks

EM



"[^""]\$[A-Z]*[0-9]"

should work just fine.

--ron


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

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