If you need help writing your regex, autoregex.xyz and regex101.com are great online resources for doing this. (Neither are affiliated with Stardog.)
If you have your regex and it's not working, the most common source of error is not escaping your backslashes. Let's take a look at an example password regex:
^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)[A-Za-z\d\S]+$
Here are the components:
- ^ and $: Start and end of line anchors, respectively.
- (?=.*[A-Z]): Positive lookahead for at least one uppercase letter.
- (?=.*[a-z]): Positive lookahead for at least one lowercase letter.
- (?=.*\d): Positive lookahead for at least one digit.
- [A-Za-z\d\S]+: This is the character class that matches one or more characters. It matches uppercase letters, lowercase letters, digits, and non-whitespace characters.
This regex won't work in Stardog as is. To use it, you'll need to escape the backslashes, like so:
^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)[A-Za-z\\d\\S]+$
If you have a regex that you're confident should work, you've escaped the backslashes, and it's still not working, file a support ticket.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article