+ Reply to Thread
Results 1 to 4 of 4

Regular Expression Pattern

  1. #1
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    314

    Regular Expression Pattern

    Hi all,

    Using Excel 2010, 2013.

    What would be the correct regular expression pattern to extract this substring : 234-456-00000000-45-234 from a string like
    mnasdf 234 234-456-00000000-45-234 sdf 123 34
    The string will vary, the substring does not vary other than the digits can be any number 0-9
    I need to retain the hyphens "-" as well

    I tried patterns like
    Please Login or Register  to view this content.
    But not working

    Thx
    w

    Please Login or Register  to view this content.
    Kind regards,
    w

    http://dataprose.org

  2. #2
    Cheeky Forum Moderator Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Regular Expression Pattern

    EDITED TO USE JosephP's pattern (which is more concise)
    Try this
    Please Login or Register  to view this content.
    Applied this way...
    A1: mnasdf 234 234-456-00000000-45-234 sdf 123 34
    B1: =findpattern(A1)

    In that example, the function returns: 234-456-00000000-45-234

    Is that something you can work with?
    Last edited by Ron Coderre; 08-16-2013 at 09:28 AM.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Regular Expression Pattern

    perhaps
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    314

    Re: Regular Expression Pattern

    Ron , JosephP -

    Thanks for your help
    I combined with some help I received earlier from shg and using these 2 functions I now have exactly what I need.

    Thanks again,
    w

    Please Login or Register  to view this content.

+ 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 Expression Pattern All Letters In String
    By goss in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-05-2013, 12:13 AM
  2. Regular Expression Pattern May Include Decimal
    By goss in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2013, 02:15 PM
  3. regular expression to extract multi instances of pattern from cell
    By starfish_001 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-11-2013, 07:45 PM
  4. [SOLVED] Regular Expression
    By Kvramana in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 05:32 AM
  5. Regular Expression Pattern Testing Add-In
    By Firefly2012 in forum The Water Cooler
    Replies: 1
    Last Post: 02-19-2012, 06:52 PM

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