+ Reply to Thread
Results 1 to 6 of 6

Problems working with .Pattern formula and Regular Expressions

  1. #1
    Registered User
    Join Date
    12-27-2013
    Location
    Miami, Florida
    MS-Off Ver
    Excel 2013
    Posts
    14

    Problems working with .Pattern formula and Regular Expressions

    Hello,

    I apologize as I am trying to minimize turning to the forum for basic problems. In trying to properly adjust the code, I have run into an issue regarding the .Pattern line of VBA code.

    Here is the excellent code that was given to me:
    Please Login or Register  to view this content.
    When I apply the code to the data (see attachment), this is the result and what I need:
    Desired Results.jpg

    However, I tried to adjust the .Pattern formula to parse the other data from the same document. I attempted this by replacing:
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    The result I get is:
    Store Promotions Parse Attempt.jpg

    I also tried replacing:
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    The result I get is:
    Online Day Stages Parse Attempt.jpg

    I'm very new to VBA code and I think that my mistake is in understanding how Regular Expressions work. Would it be possible for someone to correct my two attempts (as seen above) at changing the .Pattern formula? Also, if it is convenient, could it be briefly explained why my adjustments do not work with the current Regular Expression?

    Thank you so much for your time and I look forward to any assistance offered.
    Attached Files Attached Files

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Problems working with .Pattern formula and Regular Expressions

    Hi phoenixjasper,
    try to change this line
    Please Login or Register  to view this content.
    and this line
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Problems working with .Pattern formula and Regular Expressions

    A quick point..

    I apologize as I am trying to minimize turning to the forum for basic problems
    I certainly wouldn't call trying to get help with Scripting Dictionary, Regex and ArrayList anything closely resembling a basic problem...

    Somewhere to test Regex patterns:

    http://www.regexr.com/

    and

    https://regex101.com/

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Problems working with .Pattern formula and Regular Expressions

    Re PM
    Would you be able to arrange the code as you want?
    Patterns are there in myPtns.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-27-2013
    Location
    Miami, Florida
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Problems working with .Pattern formula and Regular Expressions

    Quote Originally Posted by nilem View Post
    Hi phoenixjasper,
    try to change this line
    Please Login or Register  to view this content.
    and this line
    Please Login or Register  to view this content.
    Thanks so much for the quick response, nilem! I did try that code and it worked great. This was also a parse that I needed but did not make it that far after my first two attempts did not work. I should be able to include your line of code along with the others from above.


    Quote Originally Posted by apo View Post
    A quick point..



    I certainly wouldn't call trying to get help with Scripting Dictionary, Regex and ArrayList anything closely resembling a basic problem...

    Somewhere to test Regex patterns:

    http://www.regexr.com/

    and

    https://regex101.com/
    Thanks a ton for the response, as well! I will use some of my weekend to get a better feel for the Regex patterns from both sites. Glancing over it, it looks like a great resource.

  6. #6
    Registered User
    Join Date
    12-27-2013
    Location
    Miami, Florida
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Problems working with .Pattern formula and Regular Expressions

    Quote Originally Posted by jindon View Post
    Re PM
    Would you be able to arrange the code as you want?
    Patterns are there in myPtns.
    The newest code you suggested is better than I was hoping for! I played around with it just a little bit and here is the final product (including code suggested by nilem):

    Please Login or Register  to view this content.
    Thank you so, so very much for your help! Especially for the quick responses!
    Last edited by phoenixjasper; 06-10-2015 at 11:22 PM. Reason: Forgot a line of code

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Regular Expressions in VBA
    By BS Singh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2014, 03:29 PM
  2. Working with words with regular expressions (replace)
    By Odeen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-30-2012, 03:43 AM
  3. Regular Expressions in VBA
    By samualt in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-08-2011, 11:34 PM
  4. Regular expressions
    By JeffMelton in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2006, 09:00 PM
  5. [SOLVED] Regular Expressions in VBA?
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-10-2005, 02:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1