1

Topic: Help to make a pattern

Kind all day.
Help to write a pattern and to not mastered teapot for  lines on javascript.
Is input there it is entered are entered a time frame in a format of days of hours of minutes of seconds.
Should transit on check here such variants:
1) 2510310. (Main)
And various variations:
2) 250310. (Likely it is No1)
3) 1530
4) 105
5) 10
6) 15
7) 30
8) 25311
is a day,  - hours, m-minutes, s-seconds.
I think the task not difficult for No1. Help at least for it. Remaining .
Thanks.

2

Re: Help to make a pattern

;
Many thanks!

3

Re: Help to make a pattern

andron81 wrote:

Should transit on check here such variants:
1) 2510310. (Main)
And various variations:
2) 250310. (Likely it is No1)
3) 1530
4) 105
5) 10
6) 15
7) 30
8) 25311

I will offer such variant...

var re = / (\d\d? []) {1,4}/;
var str = ' 2510310 ';
alert (str + ' = ' +re.test (str));
str = ' 105 ';
alert (str + ' = ' +re.test (str));

4

Re: Help to make a pattern

krvsa, thanks. Too I will try

5

Re: Help to make a pattern

If you use the regular expressions for a solution of a problem - at you two problems.
https://regex101.com/r/FjYqW5/3

6

Re: Help to make a pattern

Ruslan Damirovich;
About what problems speech?

7

Re: Help to make a pattern

andron81 wrote:

Ruslan Damirovich;
About what problems speech?

Here about this:

andron81 wrote:

Is input there it is entered are entered a time frame in a format of days of hours of minutes of seconds.

Instead of making 4 data entry fields: days, hours, minutes, seconds, you heroically search  for the decision on .