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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:25:09+00:00 2026-05-29T20:25:09+00:00

var REGEX = new RegExp((?=[hms])g) var TIME = _GET(‘t’, ‘0’).split(REGEX) var hours = TIME[TIME.indexOf(‘h’)-1]

  • 0
    var REGEX = new RegExp("(?=[hms])g")

    var TIME = _GET('t', '0').split(REGEX)

    var hours = TIME[TIME.indexOf('h')-1]

    var minutes = TIME[TIME.indexOf('m')-1]

    var seconds = TIME[TIME.indexOf('s')-1]

    var HOURS = hours?('hours: '+hours):''

    var MINUTES = minutes?('minutes: '+minutes):''

    var SECONDS = seconds?('seconds: '+seconds):''

    document.write('TIME RECIEVED:<br><br>'+HOURS+'<br>'+MINUTES+'<br>'+SECONDS)

this is the entire code. I basically wanted to see if I could mimick youtube’s video trick (put &t=XhYmZs to go to that time in a video)

The only missing thing is that I don’t know regular expressions >_<

What I need is to split the string "5h55m55s" into ['5','h','55','m','55','s'] instead of ['5', 'h55', 'm55', 's'], which is breaks my code. Oh yeah, and the _GET function is unimportant, it just obtains a string from the url, like php’s $_GET variable

So Obviously, the regex /(?=[hms])/ doesn’t work completely and I need to know how to get it to split both on the “left” and “right” of h, m, and s

Basically, the answer to this question is a regexp that splits, for example, "55m55s" into the array ['55','m','55','s']

  • 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-29T20:25:12+00:00Added an answer on May 29, 2026 at 8:25 pm

    You could something like…

    var parts = "5h55m55s"
       .split(/(\d+)/).filter(function(a) { return a; });
       // ["5", "h", "55", "m", "55", "s"]
    

    jsFiddle.

    This will drop times of 0. If that is possible, change the filter() body to return a.length.

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

Sidebar

Related Questions

var search = new RegExp(<span class=\highlight\>(?<text>.*)</span>, g); Is there something wrong with the RegEx?
I have this regex on Javascript : var myString=aaa@aaa.com; var mailValidator = new RegExp(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*);
This works: var r=xS; var regex = new RegExp(r); // Anchor at the end
var url_pattern = new RegExp((?:http| https)://(www.|.*)someurlhere[.]com/\d\d\d\d/\d\d/\d\d/.*/, i); var url=window.location; //or could be document.URL both
I have the following code (AS3 & CS 5.5): var regEx:RegExp = new RegExp(/(?:^|\s)(\#[^\s$]+)/g);
var txtpattern = '/[a-z]+/'; var regex = new RegExp(txtpattern); var result = txtstring.match(regex); //returns
HTML new_password: <input name=new_password type=password maxlength=25 id=new_password class=ModuleTextbox onkeyup=var regex = new RegExp(/^.*(?=.{6,})(?=.*\d)(?=.*[aA-zZ@!¤&amp;/()_?,.-]).*$/m); if(regex.test(this.value))
I'm using Jquery(don't know if that's relevant), here's the regex: var re = new
This one is a real head scratcher for me... var matches = Regex.Matches(<p>test something<script
How can I test if a RegEx matches a string exactly ? var r

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.