That’s getting more complicated
For that you have to not only match the following text, but also use a capture group to grab it.
Capture groups are denoted by parens ((...)
) and will return in a match. The rules can get a little complicated but we can start with a simple example using your date. Lets use the string:
var str = "The best day in January is January 18th";
This has a month without a day and one with, and we’ll be sure to only capture the one with. We’ll assume a full month match for simplicity, so /January/
as a base:
var str = "The best day in January is January 18th";
var res = str.match(/January/g);
// ["January", "January"]
Next we need to match any numbers that follow January. We can use a similar shortcut there that we did with \w
, this time using \d
which matches only numerical digits. And for the space between, we use \s
which matches any kind of whitespace.
Before, with \w
we were matching 0 or more \w
matches with *
. We want something similar with our \d
and \s
except we want 1 or more. For that, we use +
which acts like *
but requires that at least one exist for a match. That gives us:
var res = str.match(/January\s+\d+/g);
// ["January 18"]
Now the tricky part is pulling out the number without the month. For this we use the capture group, wrapping the \d+
in parens. But for this to work with match
we need to drop the global flag.
var res = str.match(/January\s+(\d+)/);
// ["January 18", "18"]
The capture group is showing a second match after the full expression match which relates to the capture group specified with the parens - our number. It’ll be in string form, but you can throw it into a parseInt
to fix that 
If you want global flag search behavior, you’ll want to use RegExp.exec instead. Examples in that link show how looping through exec can get you multiple captures throughout a single string.