Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7076365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:17:22+00:00 2026-05-28T06:17:22+00:00

I need a value between two characters in a string.The values are between {

  • 0

I need a value between two characters in a string.The values are between { and }. Sometimes there may be more then 1 occurrence.

  var = split("this {is}  a {test}","{")
 var = split("this {is}  a {test}","}")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:17:23+00:00Added an answer on May 28, 2026 at 6:17 am

    I don’t believe that splitting the string would be a solution since you need to know the position of the character that is splitting your string.

    So I’m giving you two solutions

    Solution #1

    Regular Expression

    First of all, you’ll need to add the reference to VBA Regular Expression. Tool -> References & Microsoft VBScript Regular Expression 5.5

    Code

    Sub Test1()
        Dim sText As String
    
        Dim oRegExp As RegExp
        Dim oMatches As MatchCollection
    
        sText = "this {is}  a {test}"
    
        Set oRegExp = New RegExp
    
        With oRegExp
            oRegExp.IgnoreCase = True
            oRegExp.Pattern = "{([^\}]+)"
            oRegExp.Global = True
        End With
    
        Set oMatches = oRegExp.Execute(sText)
    
        For Each Text In oMatches
            Debug.Print Mid(Text, 2, Len(Text))
        Next
    End Sub
    

    Solution #2

    Linear Search

    Code

    Sub Test2()
        Dim bIsBetween As Boolean
    
        Dim iLength As Integer
    
        Dim sText As String
        Dim sToken As String
    
        bIsBetween = False
    
        sToken = ""
        sText = "this {is}  a {test}"
    
        iLength = Len(sText) - 1
    
        For I = 1 To iLength
            Dim chr As String
            Dim nextChr As String
    
            chr = Mid(sText, I, 1)
            nextChr = Mid(sText, I + 1, 1)
    
            If (chr = "{") Then
                bIsBetween = True
            End If
    
            If (nextChr = "}") Then
                bIsBetween = False
            End If
    
            If (bIsBetween = True) Then
                sToken = sToken & nextChr
            Else
                If (Len(sToken) > 0) Then
                    Debug.Print sToken
                    sToken = ""
                End If
            End If
        Next I
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to do a linear interpolation over time between two values on an
I need to be able to compute differences between two data/time values which represent
i need Enumarable value from below class but give error public static Enumerable LoadDataByName(string
I'm creating a set of enum values, but I need each enum value to
My application produces strings like the one below. I need to parse values between
How would I get a value in between two the quotes after value=? So,
i need to select some records from table Tr_cashbook between two date. the date
I have a really weird situation. I need to swap a column value between
I need to share an instance of an object between two static objects as
I need to calculate the difference of a column between two lines of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.