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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:45:33+00:00 2026-06-17T06:45:33+00:00

I need to strip out certain elements of a string. The string(s) look a

  • 0

I need to strip out certain elements of a string.

The string(s) look a little like this:

var htmlelement = '<b>Frame</b>: KHAKI TORT / MATTE BLACK<br>
<b>Lens</b>: <span class="titlecaps">SMOKE MONO</span><br>
<b>Protection</b>:  Category 3 lens - Maximum UV protection
<div><b>Hardware</b>: Initial temple badge<br>
<b>Packaging</b>: Le Specs protective pouch included<br>
<b>Gender</b>: Men

  <div><b>Model</b>: 1202055<br>
<b>Warranty</b>: Le Specs are warranted for one year against manufacturing faults from the date of purchase.<br>
<br>
<hr style="border:dotted #DDD; border-width:1px 0 0 0; height:0;line-height:0px;font-size:0;margin:0;padding:10px;">
<span style="font-family:times new roman;"><span style="font-weight:bold">DESIGNER NOTES</span><br>
<br>
This oversize and tough wayfarer style in khaki tortoiseshell features a contrast black top bar.
</span>
</div>
</div>'

as I’ve converted them from HTML elements.

What I need to strip out is the Lens and frame, so for the above string, I need to return this:

Frame: KHAKI TORT / MATTE BLACK
Lens: SMOKE MONO

To up the problems, the string may not always be exactly as presented, for example the initial string may look like this (in a different order):

<b>Model</b>: 1202080<br>
<b>Protection</b>:  Category 3 lens - Maximum UV protection
<div><b>Hardware</b><span>:</span><b>&nbsp;</b><span>Silver logo temple badge</span><br>
<b>Packaging</b>: Le Specs protective pouch included<br>
<b>Gender</b>: Women<br>
<b>Warranty</b>: Le Specs are warranted for one year against manufacturing faults from the date of purchase.<br>
<br>
<b>Frame</b>: <span style="titlecaps">BLACK PRINT</span><br>
<hr style="border:dotted #DDD; border-width:1px 0 0 0; height:0;line-height:0px;font-size:0;margin:0;padding:10px;">
<b>Lens</b>: <span class="titlecaps">SMOKE GRAD</span><br>
<span style="font-family:times new roman;"><span style="font-weight:bold">DESIGNER NOTES</span><br>
<br>
Bold and glamorous, this oversize square style features soft curves featuring signature Le Specs Aztec print.
</span>
</div>

and I still need to simply return this:

Frame: BLACK PRINT
Lens: SMOKE GRAD
  • 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-17T06:45:35+00:00Added an answer on June 17, 2026 at 6:45 am

    The steps I would take are as follows:

    1. Find the index of the substring <b>Frame</b>:
    2. Find the index of the next <br>
    3. Cut out a substring from the first index to the second index plus 4 (the length of <br>)
    4. Strip the html tags using regex
    5. Repeat process for the second line (Lens)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to strip out a condition in a string, here
I need to strip out all non standard text characers from a string. I
I need to strip out a few invalid characters from a string and wrote
I have a String that I need to strip out all the spaces except
I need to strip out any &id=SomeValue from a Url.PathAndQuery. Where SomeValue could be
I need to strip out all font tags from a document. When attempting to
I'm writing a shell script and I need to strip FIND ME out of
I have a need to strip email addresses out of paragraphs of plain text.
I am trying to use regex.replace to strip out unwanted characters, but I need
I'm looking to strip out the domain in this scenario using PowerShell. What is

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.