Regex to validate date between 1956 to 2002 [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I would like to use regex to validate date between 1956 to 2002.
Example:
11/12/1956 - Pass
11/12/1955 - Fail
11/12/2002 - Pass
11/12/2020 - Fail
Here is what I have so far.
^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19?[5-9][0-9]|[2-9][0-9][0-9][0-2])$
Challenge is on how to validate year value more than 1956.
Any idea on how to go about this?
Thanks.

Try with this regex: ^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.]((19([6-9]\d|5[6-9]))|200[0-2])$
Demo here

Related

How to Get a+b from ((a + b)/2) /3 in js regex [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 days ago.
This post was edited and submitted for review 7 days ago.
Improve this question
Need some mechanism to get (a+b) and ((a+b)/2) as capture groups from ((a+b)/2)/3 in regex javascript

I want timestamp in following format "2020-06-04T07:37:19.2623962Z" [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want timestamp in following format "2020-06-04T07:37:19.2623962Z", i am working on angular.
Hi this looks like the ISO format, this is part of the Date object in javascript. If you are using it you could simply write
new Date().toISOString();

Julian Date Converter using Javascript/Node js [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a Julian Date: 20137 (yyddd, 137th day of 2020) and I would like to see the output as 16-Sep-2020
Ref: http://www.longpelaexpertise.com/toolsJulian.php
Could someone help the logic in Javascript? Thanks in advance!
What about using moment:
const moment = require('moment');
console.log(moment("20137", "YYDDD").format("DD-MMMM-YYYY")); // 16-May-2020

persian phone number regex [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am new in programming. I want to implement phone number validation using javascript in my website. I want some regex with conditions below:
a digit with length of 11
it should start with 09
no any string or space in the input is accepted
e.g.
"09131234455" // is accepted
"091 05488963" // not accepted
thanks anyone can help!!
Try: ^09\d{9}$ (first '09', then 9 digits, all this surrounded with
"start of string" and "end of string" anchors).

RegEx string - code with JavaScript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
If I have a string in this format:
RED-MPWMC-40486655646-024
How can I extract MPWMC from this string with javascript?
No need of regex here. Just split it using - and access the array element with index=1.
var str = "RED-MPWMC-40486655646-024";
console.log(str.split("-")[1]);

Categories