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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:56:18+00:00 2026-05-20T15:56:18+00:00

I need to count a group of regular expressions in a dynamically loaded <div>

  • 0

I need to count a group of regular expressions in a dynamically loaded <div> that I’ve loaded using the load() function. I also need to resize this <div> to the longest line of characters in it. Is there a way to achieve this? I’ve tried searching around and can’t find anything, not even on SO. I should mention that the expression I am testing for is:

Sat Mar 12 12:45:38 PST 2011

Using this regex:

if ($('#result').text().match(/[A-Za-z]{3}\s[A-Za-z]{3}\s[0-9]{1,2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}\s[A-Z]{3}\s[0-9]{4}/))
  • 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-20T15:56:18+00:00Added an answer on May 20, 2026 at 3:56 pm
    var str="The rain in SPAIN stays mainly in the plain"; 
    var patt1=/ain/gi;  //noticed the g.  g will enable match of all occurance, and without it it'll only match the first occurance
    console.log(str.match(patt1).length);  //4 matched
    

    JavaScript match regex function returns an array so you can basically do a length on that array and get the size of the matched elements. Make sure you are using the g in RegEx to search all occurance

    Based on your RegEx you can do the following:

    $('#result').text().match(/[A-Za-z]{3}\s[A-Za-z]{3}\s[0-9]{1,2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}\s[A-Z]{3}\s[0-9]{4}/g).length //this should give you the total count of occurance
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got several function where I need to do a one-to-many join, using count(),
I need a function count_permutations() that returns the number of permutations of a given
I am developing an online examination using servlets/jsp.I need to add a count down
Need a function that takes a character as a parameter and returns true if
I need to identify (potentially nested) capture groups within regular expressions and create a
A continuation from this question I need a SQL statement that returns the number
Essentially I need a count of each Entries Comments: SELECT e.*, COUNT(c.id) as comments
I need to get a count of the number of files in a directory.
Need to an expression that returns only things with an I followed by either
I have tracking table tbl_track with id, session_id, created_date fields I need count unique

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.