Click here to Skip to main content
15,867,308 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 12:34
robwm110-Oct-14 12:34 
AnswerRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron10-Oct-14 12:43
professionalMatt T Heffron10-Oct-14 12:43 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 13:06
robwm110-Oct-14 13:06 
AnswerRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron10-Oct-14 13:13
professionalMatt T Heffron10-Oct-14 13:13 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 13:14
robwm110-Oct-14 13:14 
SuggestionRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron10-Oct-14 13:18
professionalMatt T Heffron10-Oct-14 13:18 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 13:19
robwm110-Oct-14 13:19 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm111-Oct-14 11:00
robwm111-Oct-14 11: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 6:37
professionalMatt T Heffron13-Oct-14 6:37 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm113-Oct-14 6:59
robwm113-Oct-14 6:59 
AnswerRe: Help with regex HTML form validation Part 2 Pin
Matt T Heffron10-Oct-14 13:15
professionalMatt T Heffron10-Oct-14 13:15 
GeneralRe: Help with regex HTML form validation Part 2 Pin
robwm110-Oct-14 13:18
robwm110-Oct-14 13:18 
QuestionHelp with regex HTML form validation Pin
robwm19-Oct-14 12:35
robwm19-Oct-14 12:35 
AnswerRe: Help with regex HTML form validation Pin
George Jonsson9-Oct-14 16:26
professionalGeorge Jonsson9-Oct-14 16:26 
SuggestionRe: Help with regex HTML form validation Pin
Richard Deeming9-Oct-14 22:27
mveRichard Deeming9-Oct-14 22:27 
GeneralRe: Help with regex HTML form validation Pin
George Jonsson9-Oct-14 23:14
professionalGeorge Jonsson9-Oct-14 23:14 
GeneralRe: Help with regex HTML form validation Pin
robwm110-Oct-14 6:03
robwm110-Oct-14 6:03 
AnswerRe: Help with regex HTML form validation Pin
Richard Deeming9-Oct-14 22:33
mveRichard Deeming9-Oct-14 22:33 
GeneralRe: Help with regex HTML form validation Pin
robwm110-Oct-14 6:11
robwm110-Oct-14 6:11 
GeneralRe: Help with regex HTML form validation Pin
Richard Deeming10-Oct-14 7:35
mveRichard Deeming10-Oct-14 7:35 
GeneralRe: Help with regex HTML form validation Pin
robwm110-Oct-14 7:39
robwm110-Oct-14 7:39 
GeneralRe: Help with regex HTML form validation Pin
Richard Deeming10-Oct-14 7:47
mveRichard Deeming10-Oct-14 7:47 
QuestionRegular expression date Pin
Member 836446830-May-14 7:27
Member 836446830-May-14 7:27 
QuestionRe: Regular expression date Pin
George Jonsson13-Sep-14 23:21
professionalGeorge Jonsson13-Sep-14 23:21 
AnswerRe: Regular expression date Pin
nagshead_obx9-Oct-14 7:10
nagshead_obx9-Oct-14 7: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.