|
Mailing Lists
|
Home /
Groups /
Regular Expressions (RegEx)
not in pattern - regex method pointcut advisor
Hello,D T 10/30/08 02:29 P Not a regex but works:Adrian Lynch 10/30/08 02:36 P > The current regular expression to handle the situation iss. isaac dealey 10/30/08 03:25 P 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 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 > 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 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
|
May 23, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||