Results 1 to 11 of 11

Thread: Removing Text from Beginning and From Middle of a String

Hybrid View

  1. #1
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Removing Text from Beginning and From Middle of a String

    use regex:

    vb Code:
    1. Dim testStr As String = "Start: 29/09/2008 End: 29/09/2008"
    2. Dim rx As New Regex("(?<=Start: )\d{2}\/\d{2}\/\d{4}")
    3. Dim StartRange As String = rx.Match(testStr).Value
    4. rx = New Regex("(?<=End: )\d{2}\/\d{2}\/\d{4}")
    5. Dim EndRange As String = rx.Match(testStr).Value
    6. MsgBox(StartRange & vbCrLf & EndRange)

    don't forget to import regex:

    vb Code:
    1. Imports System.Text.RegularExpressions

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    258

    Re: Removing Text from Beginning and From Middle of a String

    Umm I rather not use Regex - I'm getting Data from a Access Database, so I rather use Indexs and Removes Please.

Posting Permissions

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



Click Here to Expand Forum to Full Width