+ Reply to Thread
Results 1 to 19 of 19

Search not pattern in regexp

Hybrid View

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

    Re: Search not pattern in regexp

    Quote Originally Posted by daboho View Post
    If in a1= "pattern is 111-123456 and pattern 444-123456"
    The first my asking after use my udf
    I want i B1 = 111-123456 444-123456
    Second my asking
    After use udf B1=111-123456 and 444-123456
    Third my asking
    After use UDF
    In B1= 444-123456 ,C1=111-123456
    Thank before
    1) =aa(A1,"\d{3}-\d{4}")
    2) =aa(A1,"\d{3}-\d{4}",,"and")
    3) =IFERROR(aa($A1,"\d{3}-\d{4}",COLUMN(A1)),"") then fill right
    Function aa(ByVal txt As String, myPtn As String, Optional ref As Long, Optional joinStr As String)
        Dim m As Object
        With CreateObject("VBScript.RegExp")
            .Global = True
            .Pattern = myPtn
            If Len(joinStr) Then
                For Each m In .Execute(txt)
                    aa = aa & " " & joinStr & " " & m.Value
                Next
                aa = Application.Trim(Mid$(aa, Len(joinStr) + 2))
            Else
                If ref = 0 Then ref = 1
                aa = .Execute(txt)(ref - 1)
            End If
        End With
    End Function
    Last edited by jindon; 12-01-2017 at 10:32 AM.

+ 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. [SOLVED] Pattern Search
    By ssjagger in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2012, 10:41 AM
  3. 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
  4. [SOLVED] Syntax to make long RegExp Pattern readable?
    By ahartman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2010, 02:25 PM
  5. Find string within string - a solution using RegExp.Pattern
    By dschmitt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2010, 05:59 PM
  6. RegExp Pattern
    By MBCMDR in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-08-2009, 02:09 PM
  7. [SOLVED] pattern matching w/o using VBScript's RegExp Object
    By Chris W. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2005, 06:06 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