Thanks Jim for the explanation.  I was struggling with the greedy vs. loose 
problem.  Luckily for my exact need today, I could get away with providing a 
fairly narrow range for the any character {0,10} in my case today.  But knowing 
how to set CFMX to be non-greedy would be a very helpful piece of information 
for future tasks.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

"C code. C code run. Run code run. Please!"
- Cynthia Dunning



...-----Original Message-----
...From: Jim Davis [mailto:[EMAIL PROTECTED]
...Sent: Tuesday, January 11, 2005 11:20 AM
...To: RegEx
...Subject: RE: Any character, any character at all.
...
...Well - the period ("dot") means "any character" and asterisk means "zero
...or
...more".
...
...Is that what you're looking for?
...
...To do what you want to do however you should also look into what are
...called
..."greedy" settings.
...
...For example consider the following string:
...
...<p>Stuff</p><p>More Stuff</p>
...
...Normally a Regex like "<[pP]>.*</[pP]>" (this may not be right - I'm
...working
...from memory here and my memory has never been what I say it used to be)
...will
...grab the entire string.
...
...If you want to only grab the first paragraph you need to set the regex to
...be
..."not greedy".  It escapes me how to do that in CFMX (which uses Java
...RegExes), but unfortunately this just couldn't be done in CF before MX.
...
...Then things get more complicated, but not amazingly so.
...
...Hope this leads you in the right direction.
...
...Jim Davis
...
...> -----Original Message-----
...> From: Ian Skinner [mailto:[EMAIL PROTECTED]
...> Sent: Tuesday, January 11, 2005 2:01 PM
...> To: RegEx
...> Subject: Any character, any character at all.
...>
...> What is the proper way to say I will accept any kind of character,
...letter,
...> digit, white space, special or anything else?  I'm trying to create
...this
...> basic idea of a regex.
...> (aSpecificString)(anyPosibleCharacter)(aSecondSpecificString)
...>
...> Does that make sense, I guess a fairly real world example would be to
...> search for a set of tags, <P> lets say that could have anything between
...> them.
...> (<p>)(What goes here?)(</p>)
...>
...> --------------
...> Ian Skinner
...> Web Programmer
...> BloodSource
...>
...<file:///C:\Documents%20and%20Settings\iskinner\Application%20Data\Micros
...o
...> ft\Signatures\www.BloodSource.org> www.BloodSource.org
...> <http://www.BloodSource.orgSacramento>
...> Sacramento, CA
...>
...> "C code. C code run. Run code run. Please!"
...> - Cynthia Dunning
...>
...>
...> Confidentiality Notice:  This message including any
...> attachments is for the sole use of the intended
...> recipient(s) and may contain confidential and privileged
...> information. Any unauthorized review, use, disclosure or
...> distribution is prohibited. If you are not the
...> intended recipient, please contact the sender and
...> delete any copies of this message.
...>
...>
...>
...>
...>
...
...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:812
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to