House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

RegEx help

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

RegEx help

>         ^(?=.*[A-Za-z])(?= Patrick McElhaney 11/28/2006 08:10 PM
NOW you got it :-) good job. I tried a couple times myself. Then gave up... Bobby Hartsfield 11/28/2006 05:32 PM
Niiiiiiiice :D Ben Nadel 11/28/2006 05:26 PM
Sorry, can't get this outta my head now.  Too interesting a challenge. Steve Brownlee 11/28/2006 05:20 PM
'11111a111111' fails Bobby Hartsfield 11/28/2006 04:28 PM
> What engine are you testing with?  Patrick's pattern validates Patrick McElhaney 11/28/2006 04:10 PM
All numeric and all alpha should fail according to the requirements of th Bobby Hartsfield 11/28/2006 04:02 PM
What engine are you testing with?  Patrick's pattern validates against Steve Brownlee 11/28/2006 03:27 PM
No it doesn't. Neither does yours. Patrick's was closer though. Bobby Hartsfield 11/28/2006 03:21 PM
Forget my attempt, Patrick's works perfectly. Steve Brownlee 11/28/2006 02:48 PM
You could try this... Steve Brownlee 11/28/2006 02:30 PM
That looks VERY similar to one I found and tried for this thread :-) Bobby Hartsfield 11/27/2006 10:26 PM
Can't resist the challenge. :-) Patrick McElhaney 11/27/2006 09:24 PM
But I guess that?s what Ben did heh... Bobby Hartsfield 11/27/2006 11:07 AM
You can also still do it in one cfset with Ben's 2 separate expressions... Bobby Hartsfield 11/27/2006 11:05 AM
I say break it up into two different test: Ben Nadel 11/27/2006 09:33 AM
Hello all, Chris Alvarado 11/27/2006 09:09 AM

11/28/2006 08:10 PM
Author: Patrick McElhaney Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261955 >         ^(?=.*[A-Za-z])(?=.*[0-9])(?!.*[^A-Za-z0-9])(?!.*\s).{6,12}$ > Hmm... I don't think this part is necessary: "(?!.*[^A-Za-z0-9])(?!.*\s)"  No one said anything about non-alphanumeric characters being disallowed, did they? If that's what you're going for we can simplify a bit. ^(?=.*[A-Za-z])(?=.*[0-9])[A-Za-z0-9]{6,12}$ Patrick -- Patrick McElhaney 704.560.9117
11/28/2006 05:32 PM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261935 NOW you got it :-) good job. I tried a couple times myself. Then gave up... then I got annoyed and tried some more.... wash -> rinse -> repeat.... lol .:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com Sorry, can't get this outta my head now.  Too interesting a challenge. I believe this one will do it.   ^(?=.*[A-Za-z])(?=.*[0-9])(?!.*[^A-Za-z0-9])(?!.*\s).{6,12}$ LOL, as was said originally, easier to break it up into two expressions than worry about creating a monstrous pattern (as shown above). Steve Brownlee             http://www.fusioncube.net '11111a111111' fails 'aaaaa1aaaaaa' fails '11111a' fails 'aaaaa1' fails Actually... I guess everything I feed that one fails. Just go with Bens original solution. It made it MUCH easier.
11/28/2006 05:26 PM
Author: Ben Nadel Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261934 Niiiiiiiice :D Yeah, I know what you mean. I have gone back to this like three times and couldn't figure it out. I have never used chained look aheads. That's a nice little trick (or rather usage of the language). Freakin' sweet. ..................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ Sorry, can't get this outta my head now.  Too interesting a challenge. I believe this one will do it.   ^(?=.*[A-Za-z])(?=.*[0-9])(?!.*[^A-Za-z0-9])(?!.*\s).{6,12}$ LOL, as was said originally, easier to break it up into two expressions than worry about creating a monstrous pattern (as shown above). Steve Brownlee             http://www.fusioncube.net
11/28/2006 05:20 PM
Author: Steve Brownlee Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261932 Sorry, can't get this outta my head now.  Too interesting a challenge. I believe this one will do it.   ^(?=.*[A-Za-z])(?=.*[0-9])(?!.*[^A-Za-z0-9])(?!.*\s).{6,12}$ LOL, as was said originally, easier to break it up into two expressions than worry about creating a monstrous pattern (as shown above). Steve Brownlee             http://www.fusioncube.net '11111a111111' fails 'aaaaa1aaaaaa' fails '11111a' fails 'aaaaa1' fails Actually... I guess everything I feed that one fails. Just go with Bens original solution. It made it MUCH easier.
11/28/2006 04:28 PM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261925 '11111a111111' fails 'aaaaa1aaaaaa' fails '11111a' fails 'aaaaa1' fails Actually... I guess everything I feed that one fails. Just go with Bens original solution. It made it MUCH easier. .:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com > What engine are you testing with?  Patrick's pattern validates against > all numeric, all alpha, and mixed against Perl 5, JDK 1.4 and JDK 1.5 > implmenetations. He's saying "all numeric" isn't valid; there must be at least one letter. If you want to require at least one number *and at least one letter* this should work. /^(?=.*\d)(?=.*[A-Za-z]).{6,12}$/ Patrick -- Patrick McElhaney 704.560.9117
11/28/2006 04:10 PM
Author: Patrick McElhaney Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261923 > What engine are you testing with?  Patrick's pattern validates against > all numeric, all alpha, and mixed against Perl 5, JDK 1.4 and JDK 1.5 > implmenetations. He's saying "all numeric" isn't valid; there must be at least one letter. If you want to require at least one number *and at least one letter* this should work. /^(?=.*\d)(?=.*[A-Za-z]).{6,12}$/ Patrick -- Patrick McElhaney 704.560.9117
11/28/2006 04:02 PM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261920 All numeric and all alpha should fail according to the requirements of th original post .:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com What engine are you testing with?  Patrick's pattern validates against all numeric, all alpha, and mixed against Perl 5, JDK 1.4 and JDK 1.5 implmenetations. No it doesn't. Neither does yours. Patrick's was closer though. The only thing I could find that it failed on was an all numeric string 6 to 12 characters long. Yours failed for that as well as a string of all letters 6 to 12 characters long. Where's Ben Doom? lol
11/28/2006 03:27 PM
Author: Steve Brownlee Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261913 What engine are you testing with?  Patrick's pattern validates against all numeric, all alpha, and mixed against Perl 5, JDK 1.4 and JDK 1.5 implmenetations. No it doesn't. Neither does yours. Patrick's was closer though. The only thing I could find that it failed on was an all numeric string 6 to 12 characters long. Yours failed for that as well as a string of all letters 6 to 12 characters long. Where's Ben Doom? lol
11/28/2006 03:21 PM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261911 No it doesn't. Neither does yours. Patrick's was closer though. The only thing I could find that it failed on was an all numeric string 6 to 12 characters long. Yours failed for that as well as a string of all letters 6 to 12 characters long. Where's Ben Doom? lol .:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com Forget my attempt, Patrick's works perfectly. You could try this...   \b[(\d+|\w+)]{6,12}\b
11/28/2006 02:48 PM
Author: Steve Brownlee Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261904 Forget my attempt, Patrick's works perfectly. You could try this...   \b[(\d+|\w+)]{6,12}\b
11/28/2006 02:30 PM
Author: Steve Brownlee Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261899 You could try this...   \b[(\d+|\w+)]{6,12}\b Hello all, Im a bit rusty with regular expressions and I know this is an easy one so im kicking myself for not having it that much more. Im simply trying to ensure that a given string has between 6 and 12 characters and contains at least 1 numeric character. Any help would be greatly appreciated! -chris
11/27/2006 10:26 PM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261809 That looks VERY similar to one I found and tried for this thread :-) It didn?t work either. It was the same problem, '111111' validates but he asked for letters and at least 1 number. I took that as meaning it has to have at least 1 letter and at least 1 number. .:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com Can't resist the challenge. :-) "^(?=.*\d).{6,12}$" I'm not sure if this will actually work in CF. Patrick > You can also still do it in one cfset with Ben's 2 separate expressions... > > <cfset var = "abcdefg1" /> > <cfset newvar = refindnocase("[\w]{6,12}", var) AND refind("[0-9]+", var) /> ----- Excess quoted text cut - see Original Post for more -----
11/27/2006 09:24 PM
Author: Patrick McElhaney Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261803 Can't resist the challenge. :-) "^(?=.*\d).{6,12}$" I'm not sure if this will actually work in CF. Patrick ----- Excess quoted text cut - see Original Post for more -----
11/27/2006 11:07 AM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261734 But I guess that?s what Ben did heh... .:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com I say break it up into two different test: <cfif   REFind( "[\w]{6,12}", strText ) AND   REFind( "[0-9]+", strText )>    </cfif> It keeps it much more simple and easy to read than a bigger, more complex RegEx ...................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ Hello all, Im a bit rusty with regular expressions and I know this is an easy one so im kicking myself for not having it that much more. Im simply trying to ensure that a given string has between 6 and 12 characters and contains at least 1 numeric character. Any help would be greatly appreciated! -chris    _____   I've stopped 6,181 spam and fraud messages. You can too! Free trial of spam and fraud protection at HYPERLINK "http://www.cloudmark.com/sigs?rc=m874hl"www.cloudmark.com HYPERLINK "http://www.cloudmark.com/sigs?rc=m874hl" -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.14.17/553 - Release Date: 11/27/2006
11/27/2006 11:05 AM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261733 You can also still do it in one cfset with Ben's 2 separate expressions... <cfset var = "abcdefg1" /> <cfset newvar = refindnocase("[\w]{6,12}", var) AND refind("[0-9]+", var) /> .:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com I say break it up into two different test: <cfif   REFind( "[\w]{6,12}", strText ) AND   REFind( "[0-9]+", strText )>    </cfif> It keeps it much more simple and easy to read than a bigger, more complex RegEx ...................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ Hello all, Im a bit rusty with regular expressions and I know this is an easy one so im kicking myself for not having it that much more. Im simply trying to ensure that a given string has between 6 and 12 characters and contains at least 1 numeric character. Any help would be greatly appreciated! -chris    _____   I've stopped 6,181 spam and fraud messages. You can too! Free trial of spam and fraud protection at HYPERLINK "http://www.cloudmark.com/sigs?rc=m874hl"www.cloudmark.com HYPERLINK "http://www.cloudmark.com/sigs?rc=m874hl" -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.14.17/553 - Release Date: 11/27/2006
11/27/2006 09:33 AM
Author: Ben Nadel Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261716 I say break it up into two different test: <cfif   REFind( "[\w]{6,12}", strText ) AND   REFind( "[0-9]+", strText )>    </cfif> It keeps it much more simple and easy to read than a bigger, more complex RegEx ..................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ Hello all, Im a bit rusty with regular expressions and I know this is an easy one so im kicking myself for not having it that much more. Im simply trying to ensure that a given string has between 6 and 12 characters and contains at least 1 numeric character. Any help would be greatly appreciated! -chris    _____   I've stopped 6,181 spam and fraud messages. You can too! Free trial of spam and fraud protection at HYPERLINK "http://www.cloudmark.com/sigs?rc=m874hl"www.cloudmark.com HYPERLINK "http://www.cloudmark.com/sigs?rc=m874hl" -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.14.17/553 - Release Date: 11/27/2006
11/27/2006 09:09 AM
Author: Chris Alvarado Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49050#261703 Hello all, Im a bit rusty with regular expressions and I know this is an easy one so im kicking myself for not having it that much more. Im simply trying to ensure that a given string has between 6 and 12 characters and contains at least 1 numeric character. Any help would be greatly appreciated! -chris    _____   I've stopped 6,181 spam and fraud messages. You can too! Free trial of spam and fraud protection at HYPERLINK "http://www.cloudmark.com/sigs?rc=m874hl"www.cloudmark.com HYPERLINK "http://www.cloudmark.com/sigs?rc=m874hl" -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.14.17/553 - Release Date: 11/27/2006
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference