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 7663169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:59:26+00:00 2026-05-31T13:59:26+00:00

Say I have the following string: Hello how are you. Since MS Word allows

  • 0

Say I have the following string:

"Hello how are you."

Since MS Word allows for regular expressions, I can use "*" to find the complete string. But what if I want to exclude the delimiters (the quotes)? I’m afraid that MS Word doesn’t support either of the two methods explained here. My question is: would there be any way to do this in one search query?
Thanks in advance.

  • 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-31T13:59:27+00:00Added an answer on May 31, 2026 at 1:59 pm

    There are different ways to achieve what you want. Here is one way to find text in VBA Word without the dilimiters using Regex. Let’s say you have the following text in Word Document (do not copy and paste it from here as the the website distorts the Double quotes. See the screenshot)

    This is a sample

    “This is another Sample”

    “Wake me up before you go go”

    “War of the worlds”

    The code to return text using Regex between two quotes is as follows

    Sub FindText()
          Dim regEx, Match, Matches
    
          Set regEx = New RegExp
          regEx.Pattern = "([^“]*)(?=\”)"
    
          regEx.IgnoreCase = False
          regEx.Global = True
    
          Set Matches = regEx.Execute(ActiveDocument.Range.Text)
    
          For Each Match In Matches
             Debug.Print Match.Value
          Next
    End Sub
    

    and if you want to say find "Wake me up before you go go" without quotes then you can use this as well

    Sub FindText()
          Dim regEx, Match, Matches
          Dim searchText As String
    
          searchText = "Wake me up before you go go"
          Set regEx = New RegExp
          regEx.Pattern = "([^“]*)(?=\”)"
    
          regEx.IgnoreCase = False
          regEx.Global = True
    
          Set Matches = regEx.Execute(ActiveDocument.Range.Text)
    
          For Each Match In Matches
             If Trim(Match.Value) = (searchText) Then
                Debug.Print "Found"
             End If
          Next
    End Sub
    

    NOTE: The website distorts the actual double quote so I am posting screenshots.

    enter image description here

    FOLLOWUP

    For the sample file that you posted, use this code

    Sub FindText()
        Dim regEx, Match, Matches
    
        Set regEx = New RegExp
        regEx.Pattern = """([^""]*)"""
        regEx.IgnoreCase = False
        regEx.Global = True
    
        Set Matches = regEx.Execute(ActiveDocument.Range.Text)
    
        For Each Match In Matches
            Debug.Print Match.SubMatches(0)
        Next
    End Sub
    

    Sample File can be downloaded from here. Please note that this link will be active for 7 days.

    Sample File

    HTH

    Sid

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following string: hello my car is red and my shoe
Let's say I have following string: string test = False; I can't loop the
say I have the following string: "Hello there. My name is Fred. I am
Say I have the following string: $str = Hello, my name is Bob and
Say for example I have the following string: var testString = Hello, world; And
Say I have the following: char* string = Hello, how are you?; Is it
Say I have the following: string fromTime = 8:00am; string someDate = 06/01/2012; I
Say I have the following: namespace SomeProject { public interface ISomething { string SomeMethod();
Say I have the following line in a method: String encodedString = URLEncoder.encode(foo, utf-8);
Say I have the following code: class Parent { static string MyField = ParentField;

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.