+ Reply to Thread
Results 1 to 21 of 21

Password data validation (regex code?)

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Password data validation (regex code?)

    Hi,

    i have to implement DV for passoword like here:

    https://docs.microsoft.com/en-us/azu...-creating-a-vm

    from website:

    Passwords must be 6 - 72 characters in length and meet 3 out of the following 4 complexity requirements:

    Have lower characters
    Have upper characters
    Have a digit
    Have a special character (Regex match [\W_])
    i have to add function in VBA and add to named range and this named range add to dv custom field.

    How to write the function?
    Use regex class?

    Please help,
    it is complex thing.

    Best,
    Jacek

  2. #2
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    Hi,

    i created a code but i need help with this to combine separated regexes patterns :

    Please Login or Register  to view this content.
    in this case 3 conditions are met: 2,3 and 4 without first (no Upper case letters here) so whole function is True (if 3 or 4 conditions are met = true, otherwise = false).

    How can i do this without counter in one pattern statement? It is possible ?

    Best,
    Jacek

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    Bump anyone?

    Jacek

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    Please help,

    Jacek

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,923

    Re: Password data validation (regex code?)

    Try this:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    Hi,

    what is the difference between my function?

    The goal of this topic is to group all regex pattern into one pattern statement.

    To have all requirements in one place?

    Best,
    Jacek

  7. #7
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Password data validation (regex code?)

    try:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  8. #8
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    hi,

    thank you very much.

    Can you explain how this is working ?

    Best,
    Jacek

  9. #9
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Password data validation (regex code?)

    (?=.*[a-z]) #Check if there is at least one lowercase in string
    (?=.*[A-Z]) #Check if there is at least one uppercase in string.
    (?=.*[0-9]) #Check if there is at least one digit in string
    (?=.*\W) #Check if there is at least one special character in string.
    .*$ #catch full string if all the conditions are met

  10. #10
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    thank you.

    .*$ #catch full string if all the conditions are met
    I need here not all conditions but only 3 from 4 have to be met.
    It is possible to do this?

    Jacek

  11. #11
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Password data validation (regex code?)

    I am not good enough with regExp. I am not sure is it possible.
    IMHO criteria is criteria, if you create criteria it has to be met.

  12. #12
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    Thank you,

    criteria are:

    Passwords must be 6 - 72 characters in length and meet 3 out of the following 4 complexity requirements:

    Have lower characters
    Have upper characters
    Have a digit
    Have a special character (Regex match [\W_])

  13. #13
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Password data validation (regex code?)

    I've seen it. I don't know to to implement 3 out of 4 into RegExp pattern.

  14. #14
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    ok thank you,

    maybe this is not possible.
    Or maybe there is another class.

    Jacek

  15. #15
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    It is possible ?

    Jacek

  16. #16
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Password data validation (regex code?)

    If it must be single pattern ( because so many people hate loops ), then :

    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  17. #17
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    o wow,

    thank you.
    | this means OR?
    and this? ^ what does it mean?

    So you provided all combinations and use OR hmm interesting!
    But maybe loop is better here

    Jacek

  18. #18
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Password data validation (regex code?)

    You are welcome, thanks for the reps.

    Yes, | is or, ^ is anchor for beginning of string, $ is anchor for end of string.

    Yes, I combine KOKOSEK's pattern using OR operator.

    If you are using loop, then actually you have provided the solution for yourself in your OP statement, aren't you ?

  19. #19
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    Yes,

    exactly but i thought that there is only some magic short code to do this

    Jacek

  20. #20
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Password data validation (regex code?)

    AFAIK, no short pattern for this.

    To match independent position of pattern (location of occurrence is not important, can be shuffled and combined), the regex look ahead method (?=) must be used.
    But look ahead doesn't capture anything, it is just used as another "prerequirements" to the pattern, so we cannot examine this look ahead result (there is no result from the look ahead pattern itself).
    So, as the consequences, you have to include all the combinations, in single pattern.

    Regards

  21. #21
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Password data validation (regex code?)

    Thank you once Again,

    Jacek

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Instr with RegEx - Runtime error 5017 (RegEx Code provided)
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2018, 05:02 PM
  2. [SOLVED] Simplification for regex code to replace numbers in a comma delimited string
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2018, 06:30 AM
  3. [SOLVED] RegEx pattern, code exacuting but doing nothing
    By capson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2015, 03:48 PM
  4. Not able to use the regex in code...
    By lifeankit in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-22-2014, 06:54 AM
  5. Need a new regex .pattern for comparison code
    By Swiss Cheese in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2012, 09:16 PM
  6. Password for Data Validation selected List
    By hecgroups in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2012, 02:16 AM
  7. RegEx Check password string
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2006, 06:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1