mercredi 12 juin 2019

HTML5 Pattern Design

Inside my logic I need a string var to be persisted in database, that string is in fact some sort of time format customized toString variable on the following way:

(days)d(hours)h(minutes)m

example 2 days 15 hours and half => 2d15h30m

I would like to make sure no one trolls on the text input expecting that format to be submitted and giving another one, I've always been awful building patterns and regex can someone please help me quickly with this one?

I've tried myself:

([0-9]{1}|[0-9]{1}|[0-9]{1})d([0-1]{1}[0-9]{1}|20|21|22|23)h([0-5]{1}|[0-9]{1})m

But it didn't workout, just like everytime I try to build one of those.

Best regards to everyone hope the question is clear for you! Thanks.

Aucun commentaire:

Enregistrer un commentaire