Consulting

Results 1 to 10 of 10

Thread: Regular Expression syntax

  1. #1
    VBAX Newbie
    Joined
    Nov 2005
    Posts
    3
    Location

    Regular Expression syntax

    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.

  2. #2
    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.
    Last edited by unmarkedhelicopter; 01-04-2008 at 07:20 PM.
    2+2=9 ... (My Arithmetic Is Mental)

  3. #3
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    "Janitor priciple"?

  4. #4
    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.
    2+2=9 ... (My Arithmetic Is Mental)

  5. #5
    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.

  6. #6
    VBAX Expert
    Joined
    Jul 2004
    Location
    Wilmington, DE
    Posts
    600
    Location
    Regards,

    Patrick

    I wept for myself because I had no PivotTable.

    Then I met a man who had no AutoFilter.

    Microsoft MVP for Excel, 2007 & 2008

  7. #7
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Quote Originally Posted by matthewspatrick
    I can't view the answer
    Is it really worth it to pay to join that site?




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  8. #8
    VBAX Expert
    Joined
    Jul 2004
    Location
    Wilmington, DE
    Posts
    600
    Location
    Quote Originally Posted by malik641
    I can't view the answer
    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.
    Regards,

    Patrick

    I wept for myself because I had no PivotTable.

    Then I met a man who had no AutoFilter.

    Microsoft MVP for Excel, 2007 & 2008

  9. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Quote Originally Posted by malik641
    I can't view the answer
    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.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  10. #10
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    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.




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •