My password.regex isn't working how I expect it to

Created by Steve Place, Modified on Fri, 06 Oct 2023 at 09:42 AM by Steve Place

If you need help writing your regex, and 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:


Here are the components:

  1. ^ and $: Start and end of line anchors, respectively.
  2. (?=.*[A-Z]): Positive lookahead for at least one uppercase letter.
  3. (?=.*[a-z]): Positive lookahead for at least one lowercase letter.
  4. (?=.*\d): Positive lookahead for at least one digit.
  5. [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:


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

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article