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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:13:22+00:00 2026-06-09T14:13:22+00:00

I successfully used replace-regexp interactively to replace every instance of quoted text in the

  • 0

I successfully used replace-regexp interactively to replace every instance of quoted text in the buffer shown below with a non-quoted version. The regexp I searched for was

\"\([^\"]*\)\" 

and the NEWTEXT I inserted was \1.

* "PROJECT START"
:PROPERTIES:
:ID: 1
:Unique_ID: 17
:DURATION: "0 days"
:TYPE: "Fixed Work"
:OUTLINE_LEVEL: 1
:END:

Interactively, the aboe text was turned into the text below.

* PROJECT START
:PROPERTIES:
:ID: 1
:Unique_ID: 17
:DURATION: 0 days
:TYPE: Fixed Work
:OUTLINE_LEVEL: 1
:END:

I tried to do this same search and replace programmatically by inserting the following two lines

(while (re-search-forward "\"\([^\"]*\)\"" nil t)
  (replace-match "\1" nil nil ))

at the top of the buffer and executing, but it simply returned nil without finding a single match.

When I omit the

\( \) 

grouping and replace \1 with \&

(while (re-search-forward "\"[^\"]*\"" nil t)
  (replace-match "\&" nil nil ))

I get every quoted string replaced with ‘&’.

* &
:PROPERTIES:
:ID: 1
:Unique_ID: 17
:DURATION: &
:TYPE: &
:OUTLINE_LEVEL: 1
:END:

Everything I’ve seen in the documentation for both of these functions indicates that they should recognize these special characters, and the examples of its use in responses to other questions on this forum use these special characters.

Can anyone help me understand why the grouping and \&, \N, \ characters aren’t being interpreted correctly?

  • 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-06-09T14:13:24+00:00Added an answer on June 9, 2026 at 2:13 pm

    You need to escape the “\”s for “(“, “)”, and “\1”. I.e.:

    (while (re-search-forward "\"\\([^\"]*\\)\"" nil t)
      (replace-match "\\1" nil nil ))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Successfully used jquery-infinite-carousel in the past but for my current project I need it
I successfully used this code within a powerpoint odule, but when I move it
I have successfully used the Excel and Word addin templates in Visual studio 2008
Has anyone successfully used Tokyo Cabinet / Tokyo Tyrant with large datasets? I am
I've successfully used ObjectOutputStream and ObjectInputStream to serialize and deserialize objects for a server
I have created a REST web service and successfully used it with a client.
I have been trying to post using RestKit after I have successfully used it
I'm just curious to know if anyone has used (successfully) Fusion Charts with Open
I used to have this kind of simple JSON data and I could successfully
I've successfully compiled my library on Linux and Mac and used it with Java

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.