RE: Regex ex question. How to match NOT this string.

2006-01-09 Thread Munson, Jacob
 So the JDK uses Perl which is why my
 lookbehind worked in my class, and then CF uses a 
 proprietary version of Perl's implementation.

I wouldn't say proprietary, I'd say incomplete.  Perl's Regular
Expressions are extremely powerful and complex, from what I've seen.  I
get lost pretty quickly looking at the full documentation for them, but
the perlrequick or perlretut man pages are pretty simple, yet still
incomplete.

I guess the CF team decided they could please most developers with a
subset of Perl's syntax, and I'd say I have yet to find a problem that
CF's regex wouldn't solve, in my limited experience.  :)


-

This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. A1.



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228851
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-07 Thread Steven Brownlee
Thanks for the investigating, Jacob.  So the JDK uses Perl which is why my
lookbehind worked in my class, and then CF uses a proprietary version of
Perl's implementation.  Something just doesn't feel right about all that...
just not sure what.

Well, no matter.  You're right that tinkering with how you structure your
pattern, you can mimic the [negative/positive] lookbehind function.

-Original Message-
From: Munson, Jacob [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 06, 2006 6:04 PM
To: CF-Talk
Subject: RE: Regex ex question. How to match NOT this string.

I just looked in my Advanced Macromedia ColdFusion MX 7 Application
Development book (what a title! ;)), written by Ben Forta and a bunch of
other folks, and this paragraph is very on topic:

...these additions make ColdFusion's RegEx support much more powerful, and
much closer to the way regular expressions work in Perl, which for many
people is the de facto standard for how regular expressions should behave.
The additions they are talking about are things like look ahead, word
boundaries, escape sequences, etc.  Also, this sentence answers our previous
question ColdFusion does not support (Perl's) lookbehind processing...

Also, it looks like Java uses Perl's syntax as well:
http://tinyurl.com/ay8kc


~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228693
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-06 Thread Steve Brownlee
Ok, ok, so I didn't actually try an example in CF  :)

CF must use a different RegEx engine than what I'm used to using.  The ?! is
negative lookbehind because he said he wanted to grab the /organization
tag.

 -Original Message-
 From: Munson, Jacob [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 05, 2006 6:16 PM
 To: CF-Talk
 Subject: RE: Regex ex question. How to match NOT this string.
 
 Steve,
 
 That causes an error.  What's the '' in between the '?' and '!'
 supposed to do (a typo?)
 
 Ian,
 
 Try this:
 
 cfset MyString = /organization title
 cfset MyResult = 
 ReFind((/organization)(?!\s*title),MyString, 1,
 yes)
 cfset MyResult2 = ReFind((/organization)(?!\s*div),MyString, 1,
 yes)
 cfoutput#MyResult.pos[1]#br#MyResult2.pos[1]#/cfoutput
 
 MyResult = 0 because there was a title tag, MyResult2 = 1 because it
 looked for a (which wasn't there) div tag.So you could 
 throw that
 in a CFIF MyResult gt 0, or whatever suits your needs.  Is that what
 you were looking for?

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228653
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-06 Thread Steve Brownlee
Ok, this is strange.  That RegEx works in Java so CF isn't using the
JDK-provided RegEx implementation?  Looks like it's using the Perl 5
implementation.  Seems counter-productive (if my assumption is correct, of
course).

Anyway, with that implementation, here's what I came up with.

cfscript
searchString = /organizationtitle;
matchStruct = StructNew();
matchStruct = REFind((/organization)(?=\s*title),searchString,1,true);
trueMatch = Mid(searchString, matchStruct.pos[1], matchStruct.len[1]);
/cfscript

cfdump var=#trueMatch#

 -Original Message-
 From: Steve Brownlee [mailto:[EMAIL PROTECTED] 
 Sent: Friday, January 06, 2006 12:07 PM
 To: CF-Talk
 Subject: RE: Regex ex question. How to match NOT this string.
 
 Ok, ok, so I didn't actually try an example in CF  :)
 
 CF must use a different RegEx engine than what I'm used to 
 using.  The ?! is
 negative lookbehind because he said he wanted to grab the 
 /organization
 tag.

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228658
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Regex ex question. How to match NOT this string.

2006-01-06 Thread Scott Stroz
I don't think CF supports lookbehind.

On 1/6/06, Steve Brownlee [EMAIL PROTECTED] wrote:

 Ok, this is strange.  That RegEx works in Java so CF isn't using the
 JDK-provided RegEx implementation?  Looks like it's using the Perl 5
 implementation.  Seems counter-productive (if my assumption is correct, of
 course).

 Anyway, with that implementation, here's what I came up with.

 cfscript
 searchString = /organizationtitle;
 matchStruct = StructNew();
 matchStruct =
 REFind((/organization)(?=\s*title),searchString,1,true);
 trueMatch = Mid(searchString, matchStruct.pos[1], matchStruct.len[1]);
 /cfscript

 cfdump var=#trueMatch#

  -Original Message-
  From: Steve Brownlee [mailto:[EMAIL PROTECTED]
  Sent: Friday, January 06, 2006 12:07 PM
  To: CF-Talk
  Subject: RE: Regex ex question. How to match NOT this string.
 
  Ok, ok, so I didn't actually try an example in CF  :)
 
  CF must use a different RegEx engine than what I'm used to
  using.  The ?! is
  negative lookbehind because he said he wanted to grab the
  /organization
  tag.

 

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228668
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-06 Thread Munson, Jacob
You are correct, CF uses Perl's regular expression syntax, and so do a
lot of other languages.  It seems that a lot of people recognize Perl's
regex as one of the best implementations available (and very popular,
thus well known) and I'm assuming that's why the CF developers went with
it.  Fortunately for me, I learned regex in Perl before I tried them in
CF.  :-D 

 -Original Message-
 From: Steve Brownlee [mailto:[EMAIL PROTECTED] 
 Sent: Friday, January 06, 2006 10:38 AM
 To: CF-Talk
 Subject: RE: Regex ex question. How to match NOT this string.
 
 Ok, this is strange.  That RegEx works in Java so CF 
 isn't using the
 JDK-provided RegEx implementation?  Looks like it's using the Perl 5
 implementation.  Seems counter-productive (if my assumption 
 is correct, of
 course).

--


[INFO] -- Access Manager:
This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law.  If you are not the 
intended recipient, you are hereby notified that any disclosure, copying, 
distribution, or use of the information contained herein (including any 
reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in 
error, please immediately contact the sender and destroy the material in its 
entirety, whether in electronic or hard copy format.  Thank you.   A2



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228669
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-06 Thread Munson, Jacob
Scott and Steve,

This is strange, I just looked in my Perl docs;  Perl /does/ support
look behind:
(?=...) zero width positive look behind
(?!...) zero width negative look behind

I wonder why CF doesn't support this?  Maybe because it's totally
possible to do it other ways (positive look ahead could be the same as
positive look behind, depending on where you put your pattern in the
regex).  However, if you are used to using look behind, and it's not in
CF, that's a let down.  I wonder if there are any cases where look
behind is absolutely necessary...or is it just a different syntax in CF?
Any experts out there know the answer?  Mr. Forta or Watts?

 -Original Message-
 From: Scott Stroz
 
 I don't think CF supports lookbehind.
 
 From: Steve Brownlee
 
  Ok, this is strange.  That RegEx works in Java so CF 
 isn't using the
  JDK-provided RegEx implementation?  Looks like it's using the Perl 5
  implementation.  Seems counter-productive (if my assumption 
 is correct, of
  course).
 
   -Original Message-
   From: Steve Brownlee
  
   Ok, ok, so I didn't actually try an example in CF  :)
  
   CF must use a different RegEx engine than what I'm used to
   using.  The ?! is
   negative lookbehind because he said he wanted to grab the
   /organization
   tag.


[INFO] -- Access Manager:
This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law.  If you are not the 
intended recipient, you are hereby notified that any disclosure, copying, 
distribution, or use of the information contained herein (including any 
reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in 
error, please immediately contact the sender and destroy the material in its 
entirety, whether in electronic or hard copy format.  Thank you.   A2



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228672
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-06 Thread Munson, Jacob
I just looked in my Advanced Macromedia ColdFusion MX 7 Application
Development book (what a title! ;)), written by Ben Forta and a bunch
of other folks, and this paragraph is very on topic:

...these additions make ColdFusion's RegEx support much more powerful,
and much closer to the way regular expressions work in Perl, which for
many people is the de facto standard for how regular expressions should
behave.  The additions they are talking about are things like look
ahead, word boundaries, escape sequences, etc.  Also, this sentence
answers our previous question ColdFusion does not support (Perl's)
lookbehind processing...

Also, it looks like Java uses Perl's syntax as well:
http://tinyurl.com/ay8kc

 From: Munson, Jacob
 
 Scott and Steve,
 
 This is strange, I just looked in my Perl docs;  Perl /does/ support
 look behind:
 (?=...) zero width positive look behind
 (?!...) zero width negative look behind
 
 I wonder why CF doesn't support this?  Maybe because it's totally
 possible to do it other ways (positive look ahead could be the same as
 positive look behind, depending on where you put your pattern in the
 regex).  However, if you are used to using look behind, and 
 it's not in
 CF, that's a let down.  I wonder if there are any cases where look
 behind is absolutely necessary...or is it just a different 
 syntax in CF?
 Any experts out there know the answer?  Mr. Forta or Watts?
 
  -Original Message-
  From: Scott Stroz
  
  I don't think CF supports lookbehind.
  
  From: Steve Brownlee
  
   Ok, this is strange.  That RegEx works in Java so CF 
  isn't using the
   JDK-provided RegEx implementation?  Looks like it's using 
 the Perl 5
   implementation.  Seems counter-productive (if my assumption 
  is correct, of
   course).

This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. A1.



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228681
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Regex ex question. How to match NOT this string.

2006-01-05 Thread Ian Skinner
How can I find any /organization that is not followed by an title with or 
without any amount or types of white space between them?



--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
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. 



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228563
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-05 Thread Ben Nadel
I am a bit rusty, but maybe something along this line:

(/organization)(?=!\s*title) 

This might not be the correct syntax, but I mean to say find /organization
if only there is a negative look ahead for the expression \s*title.

This might help spark some other people's better answers.

-ben
...
Ben Nadel 
Web Developer
Nylon Technology
350 7th Ave.
Suite 1005
New York, NY 10001
212.691.1134 x 14
212.691.3477 fax
www.nylontechnology.com

Sanders: Lightspeed too slow?
Helmet: Yes we'll have to go right to ludacris speed.
-Original Message-
From: Ian Skinner [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 05, 2006 4:44 PM
To: CF-Talk
Subject: Regex ex question. How to match NOT this string.

How can I find any /organization that is not followed by an title with
or without any amount or types of white space between them?



--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
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. 





~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228570
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-05 Thread Steve Brownlee
Just one correction

(/organization)(?!\s*title) 

 -Original Message-
 From: Ben Nadel [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 05, 2006 5:23 PM
 To: CF-Talk
 Subject: RE: Regex ex question. How to match NOT this string.
 
 I am a bit rusty, but maybe something along this line:
 
 (/organization)(?=!\s*title) 
 
 This might not be the correct syntax, but I mean to say find 
 /organization
 if only there is a negative look ahead for the expression 
 \s*title.
 
 This might help spark some other people's better answers.
 
 -ben
 ...
 Ben Nadel 
 Web Developer
 Nylon Technology
 350 7th Ave.
 Suite 1005
 New York, NY 10001
 212.691.1134 x 14
 212.691.3477 fax
 www.nylontechnology.com
 
 Sanders: Lightspeed too slow?
 Helmet: Yes we'll have to go right to ludacris speed.
 -Original Message-
 From: Ian Skinner [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 05, 2006 4:44 PM
 To: CF-Talk
 Subject: Regex ex question. How to match NOT this string.
 
 How can I find any /organization that is not followed by an 
 title with
 or without any amount or types of white space between them?
 
 
 
 --
 Ian Skinner
 Web Programmer
 BloodSource
 www.BloodSource.org
 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. 
 
 
 
 
 
 

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228571
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Regex ex question. How to match NOT this string.

2006-01-05 Thread Munson, Jacob
Steve,

That causes an error.  What's the '' in between the '?' and '!'
supposed to do (a typo?)

Ian,

Try this:

cfset MyString = /organization title
cfset MyResult = ReFind((/organization)(?!\s*title),MyString, 1,
yes)
cfset MyResult2 = ReFind((/organization)(?!\s*div),MyString, 1,
yes)
cfoutput#MyResult.pos[1]#br#MyResult2.pos[1]#/cfoutput

MyResult = 0 because there was a title tag, MyResult2 = 1 because it
looked for a (which wasn't there) div tag.So you could throw that
in a CFIF MyResult gt 0, or whatever suits your needs.  Is that what
you were looking for?

 -Original Message-
 From: Steve Brownlee [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 05, 2006 3:27 PM
 To: CF-Talk
 Subject: RE: Regex ex question. How to match NOT this string.
 
 Just one correction
 
 (/organization)(?!\s*title) 
 
  -Original Message-
  From: Ben Nadel [mailto:[EMAIL PROTECTED] 
  Sent: Thursday, January 05, 2006 5:23 PM
  To: CF-Talk
  Subject: RE: Regex ex question. How to match NOT this string.
  
  I am a bit rusty, but maybe something along this line:
  
  (/organization)(?=!\s*title) 
  
  This might not be the correct syntax, but I mean to say find 
  /organization
  if only there is a negative look ahead for the expression 
  \s*title.
  
  This might help spark some other people's better answers.

This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. A1.



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228580
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54