Click here to Skip to main content
14,742,134 members
Home » Discussions » Regular Expressions
   

Regular Expressions

 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 13:34
Memberrobwm110-Oct-14 13:34 
AnswerRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron10-Oct-14 13:43
professionalMatt T Heffron10-Oct-14 13:43 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 14:06
Memberrobwm110-Oct-14 14:06 
AnswerRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron10-Oct-14 14:13
professionalMatt T Heffron10-Oct-14 14:13 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 14:14
Memberrobwm110-Oct-14 14:14 
SuggestionRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron10-Oct-14 14:18
professionalMatt T Heffron10-Oct-14 14:18 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 14:19
Memberrobwm110-Oct-14 14:19 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm111-Oct-14 12:00
Memberrobwm111-Oct-14 12:00 
Well, this pattern was working yesterday on a different computer at work. I installed Expresso on my personal computer so I could work on my project over the weekend and now the pattern is not working.

^[a-zA-Z\-\s']+\.$

john1 = no matches

The pattern should match the number one because numbers are not allowed but the results are blank when I run this pattern. I could have sworn that this was working yesterday.

EDIT:

I did some further testing and discovered that the \. is breaking the pattern. If there is no period at the end; then count = 0. This pattern seems to require the period at the end and then it works correctly. The period should be allowed 0 or 1 times at the end of the string.

So the pattern below is working the way I want it to in Expresso but not when I use it in an HTA using vbscript to do the pattern matching. Vbscript is throwing an error at the line where the pattern is executed.

^[a-zA-Z\-\s']+?\.$

Not sure how to make a pattern that works in Expresso to also work with vbscript.

SOLUTION:

^[a-zA-Z\-\s']+?\.$ This pattern works when testing in Expresso but doesn't work with vbscript although this may work when used with other languages.

^[a-zA-Z\-\s']+\.{0,1}$ This is the pattern that behaves the same way as the pattern above but also works with vbscript.

MATCHES:
Jones
Jones-Smith
Jones Smith (no hyphen)
O'Leary
Van Allen (no hyphen)
Vander Ark (no hyphen)
Jones Sr.

Although this doesn't address diacritical characters, a few conversations with colleagues resulted in the decision that the risk is very low that they will be used in Active Directory. We currently have only 3 techs making entries into AD so informing them of how this pattern works will reduce the risk even further. I have worked for my organization for 14 years and no diacritical characters have been used until now so I feel pretty safe in not testing for them. It may not be the ultimate approach such as selling a product to the public but it does meet the needs of the specifications that were given to me.

Thank you! - I'd like to give a shout out to everyone who helped me out with this project! I really appreciate all of you taking the time to steer me in the right direction! I would go as far as to say that CodeProject could be just as valuable as sitting in any classroom. You may not get a certification here but the knowledge gained is invaluable. I was able to gain a solid understanding of regex in a matter of a few hours. I watched several videos but I would say this forum helped out the most because it specifically dealt with the solution that I was attempting to resolve.

modified 12-Oct-14 10:25am.

GeneralRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron13-Oct-14 7:37
professionalMatt T Heffron13-Oct-14 7:37 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm113-Oct-14 7:59
Memberrobwm113-Oct-14 7:59 
AnswerRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron10-Oct-14 14:15
professionalMatt T Heffron10-Oct-14 14:15 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 14:18
Memberrobwm110-Oct-14 14:18 
QuestionHelp with regex HTML form validation Pin
robwm19-Oct-14 13:35
Memberrobwm19-Oct-14 13:35 
AnswerRe: Help with regex HTML form validation Pin
George Jonsson9-Oct-14 17:26
professionalGeorge Jonsson9-Oct-14 17:26 
SuggestionRe: Help with regex HTML form validation Pin
Richard Deeming9-Oct-14 23:27
mveRichard Deeming9-Oct-14 23:27 
GeneralRe: Help with regex HTML form validation Pin
George Jonsson10-Oct-14 0:14
professionalGeorge Jonsson10-Oct-14 0:14 
GeneralRe: Help with regex HTML form validation Pin
robwm110-Oct-14 7:03
Memberrobwm110-Oct-14 7:03 
AnswerRe: Help with regex HTML form validation Pin
Richard Deeming9-Oct-14 23:33
mveRichard Deeming9-Oct-14 23:33 
GeneralRe: Help with regex HTML form validation Pin
robwm110-Oct-14 7:11
Memberrobwm110-Oct-14 7:11 
GeneralRe: Help with regex HTML form validation Pin
Richard Deeming10-Oct-14 8:35
mveRichard Deeming10-Oct-14 8:35 
GeneralRe: Help with regex HTML form validation Pin
robwm110-Oct-14 8:39
Memberrobwm110-Oct-14 8:39 
GeneralRe: Help with regex HTML form validation Pin
Richard Deeming10-Oct-14 8:47
mveRichard Deeming10-Oct-14 8:47 
QuestionRegular expression date Pin
Member 836446830-May-14 8:27
MemberMember 836446830-May-14 8:27 
QuestionRe: Regular expression date Pin
George Jonsson14-Sep-14 0:21
professionalGeorge Jonsson14-Sep-14 0:21 
AnswerRe: Regular expression date Pin
nagshead_obx9-Oct-14 8:10
Membernagshead_obx9-Oct-14 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.