Hi
Have a look at src/main/java/org/olat/user/propertyhandlers/_spring/userPropertiesContext.xml to make something mandatory or not,
and change the appropriate handler to something else (e.g. your own) in userPropertriesHandlersContext.xml in the same package.
Note that the Generic127CharTextPropertyHandler does already have a regexp property, so you can just modify the existing last name handler and add the regexp there
Something like this should work (not tested)
<bean id="userPropertyLastName" class="org.olat.user.propertyhandlers.Generic127CharTextPropertyHandler">
<property name="name" value="lastName" />
<property name="group" value="account" />
<property name="deletable" value="false" />
<!—- Only uppercase last names allowed —>
<property name=“regExp" value=“[A-Z]*" />
</bean>
Cheers
Florian