A recent customer request was to have the linux machine names entered manually, always be in lower case, and be 13 characters long.
Initially I tinkered with a basic Event Broker Service (EBS) Subscription to simply change the ‘Hostname’ to lower case, but then decided to enforce it in a custom form.
My first task was finding the correct expression using some search sites. After a few clicks I was able to find what I was looking for.
My working expression ended up looking like this.
Click on the Hostname field on your custom form, then the Constraints tab and paste the expression in Regular expression, and provide a useful error in the Validation error message text box.
Make sure to click the form Save button before moving to another field. I failed to do that a few times, only to discover a blank field when troubleshooting.
While the customer didn’t have a specific requirement for the other fields, I decided to research and test some other expressions for future reference. I’m sure some additional tweaking will be needed, but here goes.
IP Address / DNS Server / Gateway
There you go. As always your mileage may vary.