Regexp on custom order item

  • Posts: 50
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
3 years 2 months ago #336084

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.9.27
-- PHP version -- : 7.3.28
-- Browser(s) name and version -- : Chrome 90.0.4430.212

Hello,
i need a "custom order field" to be exactly 7 char, how can i achive this? with regexp?
i need the same for a custom order field for email value, how is the correct value to enter in the regexp field during "custom order field" configuration?

thank you

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

  • Posts: 4764
  • Thank you received: 647
  • MODERATOR
3 years 2 months ago #336085

Hello,

No need to regex, see my screenshot to see how to set your Custom field with some adjustements :



The most important is of course the red bordered part in the screenshot that prevent to enter more than 7 characters.
Hope this will fit your needs.

Regards

Last edit: 3 years 2 months ago by Philip.

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

  • Posts: 50
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
3 years 2 months ago #336088

Hello,
i already set up maximun lenght thank you!
what i need is minimum, because my filed must be of 7 char, no more no less

in addition i have another custom filed to enter an email value, and i want hikashop to check that the format is correct (an email value) so i think i need to enter the regexp but i cannot understand how to enter it
can you please provide an example?

thank you

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

  • Posts: 4764
  • Thank you received: 647
  • MODERATOR
3 years 2 months ago #336089

Hello,

Correct, forgive me I missed the point, that you need 7 characters no more, no less.
Then, you have to build a regex, you were right, have a look on this Stackoverflow topic.
=> Example :
^[:;,\-@0-9a-zA-Zâéè'.\s]{1,7}$
This regex may be useful for your needs, I add another tips in order to help you to build regex, which is often a job that can be complicated, even for us.
=> Use this online regex tool to test & analyze.

And so, in order to check that your input contains a valid email, you can use this kind of regex ( Stackoverflow link ).

Hope this will help you to achieved what you need.
regards

Last edit: 3 years 2 months ago by Philip.
The following user(s) said Thank You: matmosis

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

Time to create page: 0.060 seconds
Powered by Kunena Forum