I am trying to extract from the string the following:

Original string: M 1,81 PRT 25 12 1988

I want to extract: 25 12 1988

Basically 2numbers|space|2numbers|space|4numbers

I am struggling to do it, so far i got to this but my little experience with regex keeps me from finishing it.

Tried with this regex:


This will return the captured data as a group, and will work regardless of the whitespace character used.


Go to regex101.com and try it out. It's a good way to build your expressions.


This is a pretty easy one:

(\d{2} \d{2} \d{4})

Quite self-explanatory. \d means a digit, and {N} means the count.

  • I don't know much of regrex, but, aren't you forgetting the brackets ()? – Ender Look Apr 11 at 14:12
  • Sure, if you need to have a capturing group, the brackets should be there! – Ildar Akhmetov Apr 11 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.