Help with RegExp for Date

  • Posts: 4
  • Thank you received: 0
8 years 2 months ago #229279

-- HikaShop version -- : HikaShop Business: 2.6.1
-- Joomla version -- : Joomla! 3.4.8
-- PHP version -- : 5.5.10
-- Browser(s) name and version -- : Chrome

I've created a custom text field for a date (format: dd/mm/yyyy) and trying to write
a regexp to catch those that don't match. Not sure how it should be formatted
within the custom field screen. The field is required, so regexp should be checked.


Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 81478
  • Thank you received: 13062
  • MODERATOR
8 years 2 months ago #229288

Hi,

It depends what you want to check exactly. For example, you could write:

/^[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]$/

The following user(s) said Thank You: pippasoup@gmail.com

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
8 years 2 months ago #229401

I tried that, but it doesn't recognize the string as valid. I see that its expecting
dd/dd/dddd (d=digit/number). Images shows the error appear when a valid string
is entered and the backend setup of the field (with the regexp).

I'm confused!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
8 years 2 months ago #229448

Got it fixed.

Drop the / .... /

as part of the expression.

Thanks

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum