I cannot get 'normal' RegEx's to work, what am I doing wrong?

I’m trying to generate a social security number by a date of birth and a random number.

Day Month Year Random number
01-31 01-12 - 1234

The output should look like this:

The first two integers is a day with leading 0, the third and fourth is a month 01 to 12 with a leading zero in case of it being less than 10, the next four a year, then a dash and four random digits.

How would I do that in Mockaroo?

1 Like

Hi, I have same question. My both dates are starting with 0. So, i am confuse in it. Can someone help me to solve this question.

This can be done using inline formulas (the f(x) button).

See this example: https://mockaroo.com/88fb7fa0

In this case I used a date field with format “mm/dd/yyyy” and the following formula:

this.to_s + '-' + pad(random(1, 9999).to_s, 4, '0', 'left')