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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:44:52+00:00 2026-06-17T21:44:52+00:00

I am currently working on an HTML utility . I want to extract the

  • 0

I am currently working on an HTML utility. I want to extract the font-family used in the HTML Code using Javascript. I found this piece of Regular Expression which can find only the normal fonts:

font-family\s*?:.*?(;|(?=""|'|;))

i.e font-family:Arial, Helvetica, sans-serif

I am not able to match font families like:

font-family: 'Lucida Sans', 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;

Are there any methods available to extract the fonts/font families?

  • 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-17T21:44:53+00:00Added an answer on June 17, 2026 at 9:44 pm

    Finally I got it sorted out..

    function demo(input,output) {
    var div = document.createElement("div");
    try {
        div.innerHTML = input;
    } catch (e) {
        alert(e.message);
        return;
    }
    // images
    var images = div.getElementsByTagName("IMG");
    //console.log(images);
    
    // font-family
    var fontfamily = [];
    var ffstack = [div];
    while (ffstack.length) {
        var ff = ffstack.pop();
        if (ff.style && ff.style.fontFamily) {
                fontfamily.push(ff.style.fontFamily);
        }
        if (ff.childNodes) {
            for (var i = 0; i < ff.childNodes.length; i++) {
                ffstack.push(ff.childNodes[i]);
            }
        }
    }
    //console.log(fontfamily);
    document.getElementById("resultBlock").style.display = "block";
    var vArray = Duplicates(fontfamily);
    var fontss = vArray.join("\n\n");
    output.value =fontss;
    

    }

    function Duplicates(arr) {
    var i,
    lenn = arr.length,
        out = [],
        obj = {};
    
    for (i = 0; i < lenn; i++) {
        obj[arr[i]] = 0;
    }
    for (i in obj) {
        out.push(i);
    }
    return out;
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on an color-picker component using HTML, CSS and Javascript, one major
I am currently working in HTML and JavaScript. I am Beginner. I want to
I am a software developer who occasionally write CSS/HTML code. I am currently working
I'm currently working on a quote retrieval system for my employer's website using mysql/php/html.
I am currently working on a fun project, which involves Ajax, HTML, JavaScript, PHP
I am currently working on a php/html/javascript project and am doing ajax post to
I am currently working on an HTML, CSS, PHP project. I want to display
I am currently working on an html and php project. What I want to
I'm currently working on a web application using HTML 5, CSS and JQuery. I
I am currently working on a project and I want to create a HTML

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.