Skip to main content
Solved

Rules- with many conditions

  • June 19, 2024
  • 2 replies
  • 58 views

Hi, is it possible to have a  single rule that checks many condition. example is below  

 

i want a single rule named--Name Validation

i want this rule to check  and validate name that are in -

  • Title Case --first letter upper case follow by all lower case 
  • Accented--- Accepts accented character 
  • Accepts special characters 
  • Could have Hyphen - 

the rule should should invalidate any other names that does not meet these conditions . or is there a better way to do this ? preferred to break it down so its will be easy to know the reason why the names are not valid whenever its does not matches 

Best answer by srija piratla

Hi @olayinkadaramola ,

 

I see you want to have a single rule with all those conditions and please try this regex expression 

\b(?:[A-Z][a-z'à-öø-ÿ'-]*)(?:[\s-][A-Z][a-z'à-öø-ÿ'-]*)*(?:'[A-Z][a-z'à-öø-ÿ'-]*)?\b

This should satisfy all those conditions - 

  • Title Case --first letter upper case follow by all lower case 
  • Accented--- Accepts accented character 
  • Accepts special characters 
  • Could have Hyphen - 

I used all the examples here and it is working as expected . Please try this and let me know if you face any issues. Hope this helps.

 

Thanks,

Srija Piratla

2 replies

Forum|alt.badge.img
  • Ataccamer
  • Answer
  • June 20, 2024

Hi @olayinkadaramola ,

 

I see you want to have a single rule with all those conditions and please try this regex expression 

\b(?:[A-Z][a-z'à-öø-ÿ'-]*)(?:[\s-][A-Z][a-z'à-öø-ÿ'-]*)*(?:'[A-Z][a-z'à-öø-ÿ'-]*)?\b

This should satisfy all those conditions - 

  • Title Case --first letter upper case follow by all lower case 
  • Accented--- Accepts accented character 
  • Accepts special characters 
  • Could have Hyphen - 

I used all the examples here and it is working as expected . Please try this and let me know if you face any issues. Hope this helps.

 

Thanks,

Srija Piratla


Forum|alt.badge.img+1

Hi @olayinkadaramola, I’m closing this thread for now, if you have any follow-up questions please don’t hesitate to share them in the comments or create a new post 🙋‍♀️