This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Lookaround assertions in regex rules
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 05, 2008
03:19 PM
Lookaround assertions in regex rules
Does the Match Regular Expression rule support lookaround assertions? I can't get them to work. When I type it into the regular expression field, the text remains red.
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 05, 2008
05:52 PM
Could you post an example that fails?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2008
11:55 AM
Here is the regular expression I was trying to use:
^(?=.{8,65})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$
I wanted a rule to test a string to see if it is between 8 - 65 characters with at least one numeric, one lower case, and one upper case.
Since I couldn't get it to work with the Match Regular Expression rule, I ended up writing custom code that uses the Java STRING.matches(regular expression) with the above regular expression. It appears to work as expected.
^(?=.{8,65})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$
I wanted a rule to test a string to see if it is between 8 - 65 characters with at least one numeric, one lower case, and one upper case.
Since I couldn't get it to work with the Match Regular Expression rule, I ended up writing custom code that uses the Java STRING.matches(regular expression) with the above regular expression. It appears to work as expected.