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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:48:39+00:00 2026-06-04T04:48:39+00:00

Lets say I have this string: myString=’Hello’+yes+’Whats hello’6 I am looking for a way

  • 0

Lets say I have this string:

myString="'Hello'+yes+'Whats hello'6"

I am looking for a way to delete everything enclosed in quotes

So, it would become:

"+yes+"

Because, ‘Hello’ and ‘Whats hello’ are enclosed by quotes. And 6 is a number.

Is there a way to do this? Maybe using Regular Expressions? I tried doing this with a For Loop, but I guess my logic wasn’t that great.

  • 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-04T04:48:41+00:00Added an answer on June 4, 2026 at 4:48 am
    Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import re
    >>> re.sub(r"('[^']*'|\d)", "", "'Hello'+yes+'Whats hello'6")
    '+yes+'
    >>>
    

    (...|...) matches one thing or another; '[^']*' matches anything but a quote inside quotes; \d matches digits. re.sub(pattern, replacement, string) replaces each instance of pattern with the replacement.

    ps note that the ' in the result are just python putting quotes around the string! (you can use single or double quotes in python; python prefers single when printing strings, if the string itself doesn’t contain any).

    update – is this what you want?

    >>> import re
    >>> re.sub(r"('[^']*'|(?<![a-zA-Z])\d(?![a-zA-Z]))", "", "'Hello'+yes+'Whats hello'6")
    '+yes+'
    >>> re.sub(r"('[^']*'|(?<![a-zA-Z])\d(?![a-zA-Z]))", "", "+ye5s")
    '+ye5s'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there a way to slice a string lets say i have this variable
Lets say I have this code: public void MyMethod(string Data, List<string> InputData) { //I
Lets say I have this class in foobar-shared.lib: class FooBar { std::string m_helloWorld; }
Lets say a have a string such as this one: string txt = Lore
Let's say I have this string: Hello &, how are you? I'm fine! Is
Let's say that I have this string: s = '<p>Hello!</p>' When I pass this
can anyone help me on this.Lets say I have this array of string e.g.
Lets say I have this code: public static void main(final String [] args) {
Lets say I have string like this: String q = foo (one) bla (two)
Lets say I have this class class Child { public string FirstName { get;

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.