PDA

View Full Version : Regular Expression syntax



trekrtwo
01-04-2008, 11:50 AM
I have the below code as part of a macro within Excel. I am needing help with the syntax (I think). In the .Replace, the "\4" is literally replacing the currentname. What I need is the \4 in regular expression, ie the 4th part of my pattern. They all work in Regex Coach, so I'm hoping I just don't know how to enter it in VBA. The Msgbox below returns "True".


RegName = RegEx.Test(currentname)
MsgBox RegName
RegName = RegEx.Replace(currentname, "\4")

Any assistance will be greatly appreciated.

unmarkedhelicopter
01-04-2008, 04:43 PM
What do you mean "the 4th part of your pattern" ?
What pattern ? Where ?
What is Regex Coach ?
What are you ACTUALLY trying to do ?
Explain it to a dummy, use the janitor principle.

mikerickson
01-04-2008, 06:17 PM
"Janitor priciple"?

unmarkedhelicopter
01-04-2008, 07:23 PM
Sorry "Principle" ... i.e. explain it to the guy who just happens to be passing. He doesn't know what you do or how you do it, so you explain it from first principles. Usually, about half way through, you hit your head, say "of course" and rush off to fix the broken bit you've just found.

tmptplayer
01-05-2008, 10:29 AM
Could you provide some more information about your data? What is your expression?

There is a possibility that you need to escape your \ (I know I had to in ASP, but I don't remember having to do that in excel)... you could try "\\4" as a 10 second test to see if it works.

matthewspatrick
01-05-2008, 09:33 PM
Cross-posting:

http://www.experts-exchange.com/Q_23059686.html

malik641
01-05-2008, 09:59 PM
Cross-posting:

http://www.experts-exchange.com/Q_23059686.html
I can't view the answer :mkay
Is it really worth it to pay to join that site?

matthewspatrick
01-05-2008, 10:40 PM
I can't view the answer :mkay
Is it really worth it to pay to join [Experts Exchange]

Joseph,

For any of the regular contributors here, no, it would not be worth it to get a paid subscription at EE. However, there are non-paying options; for example, answer a small number of questions (about 2/month), and you get the same privileges as the paying members. Many people here are also involved, to widely varying degrees, at EE.

xld
01-06-2008, 02:37 AM
I can't view the answer :mkay
Is it really worth it to pay to join that site?

EE is a money making exercise by its owner(s) and should not be supported in any way by those who believe in free community support IMO. The contributors get points for answering questions that they can use to ... ask questions! Oh, and I think regular contributors can earn t-shirts and the like. Not a good model.

malik641
01-06-2008, 09:27 AM
Hmmm....

I'll just take my chances with Google's search engine to help me find what I'm looking for (not to mention forums, of course). Plus, I don't like the idea that I have to answer a minimum amount of questions (which apparently vary dependent on the value of that question) to maintain a "Premium Service" membership. Like I have to keep track of my "points" per month. No thanks.