Skip to main content

Help with RegExp for Date

More
10 years 7 months ago #229279 by pippasoup@gmail.com
-- 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.

More
10 years 7 months ago #229288 by nicolas
Replied by nicolas on topic Help with RegExp for Date
Hi,

It depends what you want to check exactly. For example, you could write:
Code:
/^[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.

More
10 years 7 months ago #229401 by pippasoup@gmail.com
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!

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

More
10 years 7 months ago #229448 by pippasoup@gmail.com
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.146 seconds
Powered by Kunena Forum