Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

REFindNocase breakdown

Posted on 2006-11-28
6
Medium Priority
?
284 Views
Last Modified: 2013-12-24
anybody want to have fun and help me break this down. I've used it and it works but it's a little beyond my understanding. What's with "museum" for example?

  <cfif not REFindNocase("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$", FORM.ClientEmailNewPassword)>
 

0
Comment
Question by:Shawn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 20

Accepted Solution

by:
trailblazzyr55 earned 2000 total points
ID: 18028058
what this regex means is this...

"^[_a-z0-9-]+   (\.[_a-z0-9-]+)*  @  [a-z0-9-]+  (\.[a-z0-9-]+)* \.(([a-z]{2,3})|(aero|coop|info|museum|name))$"

1 )Match at the beginning of the line, match an instance of an [ _ or any lowercase letter or any number or -] 1 or more times = ^[_a-z0-9-]+
2) A group match of a period followed by a match an instance of an [ _ or any lowercase letter or any number or -] 0 or more times = (\.[_a-z0-9-]+)*
3) Match a @ = @
4) Match an instance of any lowercase letter followed by any number 1 or more times = [a-z0-9-]+
5) Match a group of a period followed by a match an instance of an [ _ or any lowercase letter or any number or -] 1 or more times, 0 or more times on the group = (\.[a-z0-9-]+)*
6) Match a period followed by a group (which contains 2 groups) the | means "or"
7) Match a group of a lowercase letter no less than two and no more than three times = ([a-z]{2,3})
8) Match a case of "aero" or "coop" or "info" or "museum" or "name" = (aero|coop|info|museum|name)
9) is checking for a match of either section 8 or 9 at the end of the line $ = (([a-z]{2,3})|(aero|coop|info|museum|name))$

^ matches at the start, $ matches at the end
here's a good link to understand what each character or grouping means...
http://www.evolt.org/article/rating/20/22700/

hope that helps, by the way this matches an email address, there's a few different ways to do this one...
~trail
0
 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 18028150
"^[_a-z0-9-]+   (\.[_a-z0-9-]+)*  @  [a-z0-9-]+  (\.[a-z0-9-]+)*  \.(([a-z]{2,3})|(aero|coop|info|museum|name))$"
        1                         2             3         4                  5                      7                                8
                                                                                               |__________________6__________________|
                                                                                                  |____________________9_________________|

here's a break down of the section I explained numbered on the regex... maybe it'll help to see it sectioned out a little easier....

section 7 and 8 are groups within a group (    ([a-z]{2,3})    |     (aero|coop|info|museum|name)     )
$ means matching that overall group at the end of the line

within that group you have two groups and the overall group is checking for an instance of one or the other

(  ([a-z]{2,3}) |  (aero|coop|info|museum|name)  )  =  (  (lowercase letter 2 or 3 times)   OR    ("aero" or "coop" or "info" or "museum" or "name)   )
                                                                                           example: "ca" or "com"

the period before means checking for ".ca or .com" OR ".aero or .coop or .info or .museum or .name"

let me know if you're still unclear ;o)
0
 
LVL 1

Author Comment

by:Shawn
ID: 18028229
wow, that clears things up! thanks for taking the time.
Shawn

PS I hate using things when I don't understand them :)
0
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 18028255
with the REFindNoCase()...

 <cfif not REFindNocase("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$", FORM.ClientEmailNewPassword)>

basically this is saying <cfif> you don't find (case insensitive) an email which matches the standard format or little different format....

examples:
something@somewhere.com (standard format)
something@somewhere.ca (standard format)
""
or

something@somewhere.aero
something@somewhere.coop
something@somewhere.info
something@somewhere.museum
something@somewhere.name
""

or

something@somewhere.ca.aero
something@somewhere.tw.com
something@somewhere.com.tw
""

then do what's inside that <cfif> block
0
 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 18028282
Lol, yeah the regex's (especially when they're long) can seem overwhelming or complex, it really helps to copy it and section it out to understand what it's doing each step of the way...

Glad I was able to help clear it up some, good luck!
I know what you mean by inderstanding it too, I started learning regex's that way, had to understand what each thing meant, but before long it gets easier ;o)

Thanks,
~trail
0
 
LVL 1

Author Comment

by:Shawn
ID: 18028446
thanks again ~trail...much appreciated :-D
0

Featured Post

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question