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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:12:44+00:00 2026-06-05T16:12:44+00:00

I have an array of variables all containing text. I want to select only

  • 0

I have an array of variables all containing text. I want to select only the items containing a minute-second marker, eg. “3:00”, “4:01”, “0:23”. I understand how to go through the array, I just need to know how to implement this regex.

Just to be safe, here it is:

^(([0-9])|([0-1][0-9])|([2][0-3])):(([0-9])|([0-5][0-9]))$

I’m trying to implement it in this:

$.each(comments, function(i, val) { //Go through array with jQuery
    //Remove from array if instance of "minute:second" is not found
});

Thanks!

EDIT:

Dave Thomas requested examples. They are all YouTube comments. Examples of a comment with the minute:time and then one without are below. All taken from an example video.

  1. “1:00 Fifa 12 comentator?”
  2. “ROOOOOOOONEY <3”

EDIT2:

for (var i = 0, len = comments.length; i < len; i++) {
    if(!(comments[i].test(/(([0-5][0-9])|[0-9])\:[0-9]{2,2}/))){
        comments.splice(i,1);
    }
}​
  • 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-05T16:12:46+00:00Added an answer on June 5, 2026 at 4:12 pm

    You’ll want to be using the native filter function for fitlering arrays (there is a shim for older browsers in the link) instead of each, and you can test a regexp against a string using test:

    var pattern = /(([0-9])|([0-1][0-9])|([2][0-3])):(([0-9])|([0-5][0-9]))/;
    comments = comments.filter(function(str){
        return pattern.test(str);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array containing numbers 1-5 (sometimes more). All the members in the
Hi I have a text file containing two arrays and one value(all integers) like
I have signup form that posts all variables to signup.php. What I want to
I have a simple question: how exactly are array variables such as $_SESSION and
I have a map array with objects stuffed with variables looking like this: var
I have this ingredients array which contains multiple variables (like name, icon, value etc.).
I have an array list containing objects from the class EventOnMap . Every object
C++ doesn't allow a class containing an array of items that are not default
I have UITabBarController, containing 2 screens - A,B. I also have a strings array
I have an array of objects containing pairs of string labels and values, how

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.