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

  • Home
  • SEARCH
  • 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 6836349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:20:41+00:00 2026-05-26T23:20:41+00:00

Say I have an element in my HTML page like so: <span class=special caption[‘This

  • 0

Say I have an element in my HTML page like so:

<span class="special caption['This &lt;em&gt;expression&lt;/em&gt; describes this element.']">ABC</span>

I’d like to use jQuery to extract this “caption” from the class attribute. I know how to isolate

caption['This &lt;em&gt;expression&lt;/em&gt; describes this element.']

but what regular expression could let me extract

This <em>expression</em> describes this element.

?

Bonus points if I can incorporate an escape sequence for the apostrophe, e.g.

caption['This &lt;em style=\'color: #FF0000;\'&gt;expression&lt;/em&gt; describes this element.']

and get

This <em style=’color: #FF0000;’>expression</em> describes this ‘element.’

Thanks for all your help. I’m really challenged at regular expressions….

  • 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-26T23:20:42+00:00Added an answer on May 26, 2026 at 11:20 pm

    You probably shouldn’t be putting this info into the class attribute (see locrizak’s answer), but if you absolutely have to for some reason, read on.

    I don’t think you need a regular expression. If you already know how to get it down to this:

    caption['This &lt;em&gt;expression&lt;/em&gt; describes this element.']
    

    …then all you need to do is take that string and substring it, like so:

    var s = "caption['This &lt;em&gt;expression&lt;/em&gt; describes this element.']";
    s = s.substring(9, s.length - 2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say i have the following web page: <html> <body> <div class="transform"> <span>1</span> </div>
Lets say have this immutable record type: public class Record { public Record(int x,
Let's imagine that I have something like this: <html> ... <div> <iframe src=test.html hash=r4d5f7></iframe>
Lets take a static html page as a scenario, lets say you have a
Say I have the following HTML: <div> <span>span text</span> div text <span>some more text</span>
Say I have a web page index.html . Suppose the client goes to index.html#section2
Let's say have something like: SELECT energy_produced, energy_consumed, timestamp1 AS timestamp FROM ( SELECT
Let's say I have a large HTML file with different kinds of tags, similar
Let's say I have: var url="http://www.google.html"; how do I put the URL variable value
I'm want to create a style element after loading of page ( say about

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.