Regular Expression Match


Badge +3

Hi everyone,

I have a test column for now to check if the input password matches that of the criteria specified. The workflow is a site workflow and for the purpose of this post, I have only 1 variable called "Test Column" where password will be entered.

This is the configuration for the Regular Expression:

186685_pastedImage_0.png

Boolean default to Yes.

Criteria for password are:

- At least 1 Upper case

- 1 At least 1 Lower case

- At least 1 special character

- At least 1 number

- No length requirement

And this is the workflow - PS: This is a test one for your reference:

186692_pastedImage_1.png

In the Set Variable: Boolean = Workflow Data: string_Variable

In the Set a Condition: Test Column = string_Variable

Send notification if No: Wrong Password

Send notification if Yes: Right password

The behaviour I get is only Wrong password, even when it fits criteria.

What am I missing?


24 replies

Badge +6

Hi M K,

It looks to me like you are not introducing your password into the evaluation. What you have in the input text should surely be placed in the Pattern section and the input text should be set to your password value that you want to assess - unless I am misunderstanding what you are trying to achieve?

Cheers,

Mark

Badge +3

Hi Mark,

Thanks for your help. I think your understanding is point. I'm unsure, however, of what to put in the input text. I had thought it would be the input variable "Test Column"(?)

Badge +6

Hi,

You would definitely want the text that you want to assess in the input text field, so yes, this should be "Test Column". So insert that into the input text field and put your match pattern in the pattern field. Use the "Run Now" function on the control to test your outcome.

Cheers,

Mark

Badge +3

Hmm... it doesn't seem to work, as it gives me "False" outcome when I Run Now - Even though my entry fits the criteria being set.

Badge +3

Do you think the Regex I'm using is causing some issues with the outcome? Would it help if I build it into a string and use that variable in the Pattern instead?

Badge +6

While not using the same regex as you, I appear to have it working on the following Run Now:

This regex checks for 1 number, 1 upper case, 1 lower case, 1 symbol and a minimum size of 6 and max of 255. Do you want to paste your regex so I can copy it? It possibly looks too complex.

Cheers,

Mark

Badge +3

Certainly, thank you so much!

I've been testing a few actually, but below is what I'm currently trying to use:

"^(?=.*[a-z])(?=.*[A-Z])(?=.*d)(?=.*[$@$!%*?&])[A-Za-zd$@$!%*?&]{8,}"

Badge +6

Yes, that one does not appear to work. Some of the ones I have tested appear to work, but not necessarily for Special characters. It will be a matter of finding something to suit. I'm sorry, but I am not a RegEx expert by any stretch.

Cheers,

Mark

Badge +3

Thanks very much for your help Mark.

May I steal your Regex please? happy.png

Badge +6

Sure - but as I indicated, it doesnt seem to work properly for special characters:

(?=^.{6,255}$)((?=.*d)(?=.*[A-Z])(?=.*[a-z])|(?=.*d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*

Maybe have a look here to see if anything is appropriate:

Regular Expression Library

Cheers,

Mark

Badge +3

Perfect.

I added the Special character to it and increased the number of characters allowed - Here it is if you're interested:

(?=^.{8,}$)((?=.*d)(?=.*[A-Z])(?=.*[a-z])|(?=.*d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*d)(?=.*[A-Z])(?=.*[^A-Za-z0-9])(?=.*[@#$%]))^.*

Thanks again for all your help!

Badge +6

Still doesnt seem to work properly. I get a true result with the following passwords:

1zsssss!     - No uppercase

1zsssssA    - No Symbol

So something still doesnt seem to be processing correctly.

Badge +3

You're absolutely right!

Badge +6

This one appears to work:

(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{6,})

enforcing 1 uppercase, 1 lowercase, 1 number and 1 symbol.

Badge +3

Not working for me for some reason:

186694_pastedImage_0.png

Badge +6

Looking at your screenshot - where is this from? In my "Run Now" of a RegEx control with a Check match operation, I do not have a replacement text section. It should look like my screenshot above earlier.

Further to that, I would be putting the test password text into the Input text - replacing the {WorkflowVariable:Test Column} text.This is what the regex will be inputting as the text for the test. There should be nothing in the Replacement Text as you are not replacing anything, you are just testing for a match. This what a test should look like.

Badge +3

I can't believe I've been inputting the text in the wrong field all this time without noticing! Sorry and thanks Mark.

The screenshot is from the RegEx Check Match control - strange that it looks different.

I properly tested it now and it did work. I have a question please: If I'm setting a condition to decide what to do with the outcome (saved in the BooleanYes_No Variable), would it look something like that?

186698_pastedImage_0.png

Badge +6

If I were you and you are outputing BooleanYes_No as a string, I would set it up as below, substituting my VarTitle (Random string variable in my test workflow) with  your BooleanYes_No variable. Just check whether you need to type in the "true" or a "Yes" - I cant remember (may or may not be case sensitive too !)

You do not want to compare to your password again as you have already done this in the Regex control. You just need to see whether the result was true or false and send the workflow to the appropriate path.

Badge +3

Something is not right. When I enter a password that fits the criteria, it still give me the notification I set up for "wrong password" - even with your suggestion.

It wouldn't matter if my Boolean Variable is a Yes/ No type defaulted to Yes, would it?

Badge +6

Are you still using the set variable control on your original workflow screenshot? I wouldn't think you would need it as you should now be evaluating the Set a condition straight from your BooleanYes_No variable. The default value should not matter as you are setting the value by you regex check - where it be true or false. When you check the password in you Run now - it outputs "True"? Do you want to try a new string variable to output the regex result to? That way it should set it to either True or False and that should be easier to define in your Set a condition control.

Are you able to enable verbose logging to see what the workflow is actually doing or failing that, output the variable to history so you can see it?

Badge +3

Hi Mark,

I tested the RegEx again and yes, it is working.

I don't quite understand what you mean by setting a new string Variable - Doesn't Check Match accept only a Yes/No Variable?

PS. I had removed the Set Variable.

Badge +6

Yes - you are correct, the Check Match does only accept a boolean variable for output. So forget that - sorry. The default value on the variable should not matter, as it should be getting set in your Regex.

Badge +3

Thanks Mark – Finally got it to work!

Something was wrong with the Set a Condition, as it was just looking different for some reason. I simply deleted it and added again with the same config.

Question please: Where did you find the right RegEx? I searched a lot and got so many different answers – none of them worked!

Mariam Kabesh

Event Coordinator

+1 (250) 479-3638, 111

1-888-210-7420

www.SSI-corporate.com<http://www.ssi-corporate.com/>

Badge +6

Hi Mariam,

Excellent! We got there in the end.

You can look at the link I sent through earlier for regex examples, but I also used the link below:

https://www.thepolyglotdeveloper.com/2015/05/use-regex-to-test-password-strength-in-javascript/

Cheers,

Mark

Reply