Skip to content
the poor coder

regex for month

Poor Man
Published
Reading time
1 min read
On this page

Regex for Month#

Regular expressions or regex are patterns used to match character combinations in strings. A regex for month would match a string that contains a month name or abbreviation.

Regex Pattern:#

REGEX

    (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
  

The above regex pattern matches any month name or abbreviation in a case-sensitive manner. It uses the pipe symbol '|' to separate the different options for the months.

Other Regex Patterns:#

  • Full month name: (January|February|March|April|May|June|July|August|September|October|November|December)
  • 3-letter abbreviation: (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
  • 2-digit month number: (0[1-9]|1[0-2])

The first pattern matches the full month name, while the second pattern matches the 3-letter abbreviation. The third pattern matches the 2-digit month number, including leading zeros.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC