+ Reply to Thread
Results 1 to 6 of 6

regexp character exclude \r and \n

  1. #1
    Registered User
    Join Date
    12-25-2014
    Location
    Bourgogne, France
    MS-Off Ver
    2003
    Posts
    2

    regexp character exclude \r and \n

    Hello forum members,

    This is my 1st post, first of all I want to say hello to everyone here

    My problem is this:

    I would like to extract, from the whole string the string that immediately precedes the parentheses
    The cells contain several string separated by a carriage return – linefeed

    my data looks something like this - I Need an Output like this

    ELMS (United Autosports)
    IMSA (Action Express) ------> ELMS IMSA

    WRC (Hyundai) ------> WRC

    WEC (Toyota)
    Formula E (Renault)
    Day+Seb (Rebellion) -------> WEC Formula E Day+Seb

    NASCAR Cup
    (JTG Daugherty) -------> NASCAR Cup

    In the attached file, the values are written in column A starting at A2
    Very grateful for your help
    Please Login or Register  to view this content.
    klin89
    Attached Files Attached Files
    Last edited by klin89; 04-19-2017 at 09:38 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: regexp character exclude \r and \n

    Hi Klin89 and welcome to the forum.

    I expected to see some blanks in your cells but didn't. See if this simple formula works instead of any VBA.

    =TRIM(LEFT(A2,FIND("(",A2)-1))

    klin89 answer1.xls
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

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

    Re: regexp character exclude \r and \n

    Is this how you wanted?
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-25-2014
    Location
    Bourgogne, France
    MS-Off Ver
    2003
    Posts
    2

    Re: regexp character exclude \r and \n

    Hello everyone,

    Thanks for your reply, however, I had to express myself very badly
    The lines are separated by a carriage return in the cell.
    I need a macro to keep only the discipline that precedes the parentheses, without leaving space at the end of the string

    The picture below shows the desired result

    photo1.JPG

    klin89

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

    Re: regexp character exclude \r and \n

    Then change the pattern in your code to
    Please Login or Register  to view this content.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: regexp character exclude \r and \n

    OK - try this code to do what you want. Run it in the attached...

    Please Login or Register  to view this content.
    VBA Split vbNewLine to Rows.xls

+ 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. RegExp Pattern to remove special character
    By BS Singh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2014, 12:12 AM
  2. Formatting using Regular Expression (RegExp)
    By vnzerem in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2014, 10:03 AM
  3. [SOLVED] VBA RegExp
    By vnzerem in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2014, 05:45 PM
  4. [SOLVED] RegExp function
    By pkiula in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-17-2013, 06:22 AM
  5. Error with Set RegExp equal to New RegExp vba
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-22-2011, 05:28 PM
  6. RegExp
    By YBrazeau in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2010, 07:51 PM
  7. RegExp Pattern
    By MBCMDR in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-08-2009, 02:09 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