Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • hours can comes with 3 integers or 2 Commented Apr 19, 2017 at 6:22
  • This matchees 12h 55h. In the comments above, the OP says they are allowed to use only one h Commented Apr 19, 2017 at 6:22
  • @sachilaranawaka In that case replace {1,2} with {2,3} Commented Apr 19, 2017 at 6:22
  • /^\d{1,2}h\s+\d{1,2}m$/gi is probably better. Commented Apr 19, 2017 at 6:23
  • @jrook in that case it will be "12h 55m".match(/^(\d{1,2}h\s+\d{1,2}m)|(\d{1,2}m\s+\d{1,2}h)$/g) Commented Apr 19, 2017 at 6:24