Using regular expressions in PGV

There are many questions on community about validating some properties' values, where the best solution is using regular expressions. There are many RegExp related resources in the internet, such as or, where you can find information about RegExp syntax and online regular expression tester.

I collected some basic scenarios below, where we can use regular expressions.

For example, "I can't seem to find a way to force the first name and last name to start with an uppercase letter unless it is typed that way."

So, we create a PGV policy and add statement "must match regular expression" with value [A-Z]{1}[a-z]{1,}.



Another example: "Is there any way how I can just capture this and make it impossiple through a policy violation to create the user with the shorter logon name then 6 letters?"

So here we can use expression like ^.{6}$

Another frequent scenario is forcing user to enter phone number or year according some restrictions:

"the RegEx must match: +49 29 212 123456


After the "29" it is not allowed to use _ and -
Only digits (0-9) and white spaces are allowed.
But in my RegEx, - and _ are possible."

For this case we can use expression: ^\+[1-9][\ \d]+$


Also we can use regular expressions as workaround, if we want some attribute's value to be empty. In this case we can use expression: ^$