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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:33:26+00:00 2026-05-27T09:33:26+00:00

I know some basic regexp, but here’s the thing. Every charachter will be enclosed

  • 0

I know some basic regexp, but here’s the thing. Every charachter will be enclosed in spans.
I want things that are surrounded by quotes to be replaced, so, something like "something" would actually be

<span class="charachter">"</span>
<span class="charachter">s</span>
<span class="charachter">o</span>
<span class="charachter">m</span>
<span class="charachter">e</span>
<span class="charachter">t</span>
<span class="charachter">h</span>
<span class="charachter">i</span>
<span class="charachter">n</span>
<span class="charachter">g</span>
<span class="charachter">"</span>

(The line breaks are there just for convinience. It’s just 1 long line in the real thing.)

How do I make that into:

<span class="charachter green">"</span>
<span class="charachter green">s</span>
<span class="charachter green">o</span>
<span class="charachter green">m</span>
<span class="charachter green">e</span>
<span class="charachter green">t</span>
<span class="charachter green">h</span>
<span class="charachter green">i</span>
<span class="charachter green">n</span>
<span class="charachter green">g</span>
<span class="charachter green">"</span>

? I’m using regexp because that “something” might be anything.

BTW: The use of jQuery in the code is allowed

There are more things that are .charachter class that I don’t want to add class “green” to, just the ones enclosed in quotes

  • 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-27T09:33:26+00:00Added an answer on May 27, 2026 at 9:33 am

    This might work, depending on the complexity of your page:

    var quotes = $("span.charachter:contains('\"')");
    for (var i = 0; i < quotes.length - 1; i++) {
        quotes.eq(i).nextUntil(quotes.eq(++i)).andSelf().addClass("green");
    }
    

    Working demo: http://jsfiddle.net/3SRdD/2/

    This assumes that:

    • A span.charachter will only ever contain one single character.
    • You will never have an unmatched quote.
    • The following siblings of a span.charachter with a quote are always more span.charachter elements, at least until the closing quote.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not very conversant with jQuery and want to know some basic things
I do know some basic differences but there are still some questions in my
Here's some background. I hope someone has some ideas. I know some basic jQuery
I want to know some basic concepts of assembly language to understand it's architecture
Ok. I know this is very basic. I want to have some basic tags
I know some basic SQL, but this one is beyond me. I have looked
I have some basic questions around understanding fundamentals of Performance testing. I know that
I know this sounds confusing: I have just built some basic prev/next pagination for
What libraries/methods do you know of that can do some basic HTML representation in
to start off, I know C++, C#, Python, some Ruby, and basic Javascript. Anyway,

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.