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

Mailing Lists
Home /  Groups /  Regular Expressions (RegEx)

not in pattern - regex method pointcut advisor

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
D T
10/30/2008 02:29 PM

Hello, Please help me. I'm trying to write an expression for coldspring's regex method pointcut advisor. I'm trying to write a regular expression that is a white list of methods that I do not want intercepted. So I don't want any discard|recycle|generate|frankGrimes methods intercepted.   Please help me. The current regular expression to handle the situation is [^discard|recycle|generate|frankGrimes] I want to matched everything but.  For example:  Login, ChangePassword, GenerateStrongPassword. Suggestions?  Thanks Damien

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Adrian Lynch
10/30/2008 02:36 PM

Not a regex but works: <cfset method = "recycle"> <cfset method = "badMethod"> <cfset allowedMethods = "discard,recycle,generate,frankGrimes"> <cfif ListFindNoCase(allowedMethods, method)>   <cfoutput>#method# can come in...</cfoutput> <cfelse>   <cfoutput>#method# has no business being here!</cfoutput> </cfif> Adrian Building a database of ColdFusion errors at http://cferror.org/ Hello, Please help me. I'm trying to write an expression for coldspring's regex method pointcut advisor.  I'm trying to write a regular expression that is a white list of methods that I do not want intercepted. So I don't want any discard|recycle|generate|frankGrimes methods intercepted.  Please help me. The current regular expression to handle the situation is [^discard|recycle|generate|frankGrimes] I want to matched everything but.  For example:  Login, ChangePassword, GenerateStrongPassword. Suggestions?  Thanks Damien

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
s. isaac dealey
10/30/2008 03:25 PM

> The current regular expression to handle the situation is > [^discard|recycle|generate|frankGrimes] the characters [ and ] indicate a "class" in which will be found or not found all the individual characters... so in this case, the class you've described is the same as: [^discar|eylgntfkms] You can't have a "string" in a class, only individual characters. What you need is a negative look ahead, which might look something like this: (!discard|recycle|generate|frankGrimes).* I'm not certain that's correct -- it's been a while since I've needed a negative lookahead, so I may have fouled the syntax. hth, ike -- s. isaac dealey  ^  new epoch isn't it time for a change?      ph: 781.769.0723 http://onTap.riaforge.org/blog

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
D T
10/30/2008 05:11 PM

Thanks for the push everybody.  I read this blog post ( http://cdscott.blogspot.com/2006/07/pointcuts-even-more-fun-with-regex.html ) and basically copied it.  I understand the situation much better now especially after reading all material provided. In the end I believe this regex solved my problem. ^((?!^discard)(?!^recycle$).)*$ Avoid intercepting anything starting with discard and avoid the word recycle. and to prove it worked I used this tool - http://ryanswanson.com/regexp/#start Thanks all. Damien


<< Previous Thread Today's Threads Next Thread >>

Search regex

May 23, 2013

<<   <   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