+ Reply to Thread
Results 1 to 5 of 5

help with regex function for extract numbers out

  1. #1
    Registered User
    Join Date
    09-08-2008
    Location
    Elk Grove, California
    Posts
    21

    help with regex function for extract numbers out

    I have the following regex pattern that is extracting a number string out as needed, with one exception.
    Some of the string have a minus sign representing a negative number. the following pattern does not pick that up.

    Pattern that is working: .Pattern = "(?:[01]?\d|2[0-3]):[0-5]\d"

    I have tried using the -? before the ?:, but that does not work.

    Thank you in advance for any suggestions.

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: help with regex function for extract numbers out

    Can you tell us what is the final result you expecting?
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Registered User
    Join Date
    09-08-2008
    Location
    Elk Grove, California
    Posts
    21

    Re: help with regex function for extract numbers out

    Yes I can. Thank you for your response.
    example:
    -0:20 (27)
    0:33 (6)

    Desired results would be:
    -0:20
    0:33

    The pattern above is getting 0:20 and not picking up the minus sign, not all numbers have a minus sign, the balance are all positive numbers.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: help with regex function for extract numbers out

    Something like this?
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 -0:20 (27) -0:20
    2 0:33 (6) 0:33

  5. #5
    Registered User
    Join Date
    09-08-2008
    Location
    Elk Grove, California
    Posts
    21

    Re: help with regex function for extract numbers out

    That does the job, thank you

+ 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. [SOLVED] Generate unique numbers according to specific regex pattern
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 08-14-2018, 04:16 PM
  2. [SOLVED] Simplification for regex code to replace numbers in a comma delimited string
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2018, 06:30 AM
  3. [SOLVED] help with a function using Regex
    By Pancho3 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-24-2016, 09:22 PM
  4. [SOLVED] I need VBA function to extract numbers and sum them
    By ghazisun in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-05-2015, 02:59 AM
  5. Vba macro to extract (numbers & strings) from cell -Regex
    By zeekad in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-11-2014, 04:33 AM
  6. [SOLVED] RegEx pattern to extract multiplelines title in TXT file
    By p24leclerc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2014, 08:39 PM
  7. Worksheet function to extract numbers
    By alep002 in forum Excel General
    Replies: 8
    Last Post: 08-13-2009, 07:45 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