Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • Last Modified:

Regular expression.

[0-9]{6}

YYYYMM
200400
The expression above excepts  200400
We must not let it accept it.
0
mathieu_cupryk
Asked:
mathieu_cupryk
  • 2
1 Solution
 
mrichmonCommented:
([12][0-9]{3})(0[1-9]|1[0-2])

which allows the year to start with 1 or 2 followed by 3 digits, then the month syould be 01 upto 09 or 10 through 12
0
 
mrichmonCommented:
Also if you are using a language or parser that returns parenthesized substring matches, you will get the year in the first substring match and the month in the second.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now