Re: [Flashcoders] RegExp Help
This is great - thanks for explaining, helps a lot. the original expression I posted works this tool : http://gskinner.com/RegExr I would love to know what magic Grant is using to get it working in his RegExp utility. Thank you Anthony. On 11 Mar 2011, at 23:42, Anthony Pace wrote: Hi Karim and Ktu, Below is an explanation of what appears to be going on in the given pattern: (?:\s*) is a greedy non-capturing group of whitespace (?=[-|/]) is looking behind the next section of the expression, (?name\w*), for, what is in this case, a character set; as well, it does so without including it in the result. In this case the character set could also be written without the |, resulting in [-/] (?name\w*) is looking for name\w*, before the next expression [:|=] you may have wanted (?Pname\w*) [:|=] is a character set : or =, but again does not need the |, and could be [:=] or something like (?::|=) (((?value.*?)(?!\\))|(?value[\w]*)) is what I think you may have wanted to be an alternation, and in another language it would have worked; however, not in AS3. Apparently in AS3 in order to distinguish the syntax from a lookbehind ? you need to use the syntax ?PdesiredGroupName when defining a named group; as well, it is due to the fact that, as far as I know, in AS3 you cannot use names of the same group even a logical OR alternation. On 3/11/2011 2:37 PM, Ktu wrote: I just plugged it into RegExrhttp://www.regexr.com and I can't make sense of it. Try using that tool to build it. It really helps On Fri, Mar 11, 2011 at 5:56 AM, Karim Beyroutika...@kurst.co.uk wrote: Hello lovely list...I am trying to run a RegExp pattern on a String, and am not too sure why it's not working, and am not too sure why. Here is the code: var tStr: String= '/a:value -big=this -test:123 -test2=th_3' var r : RegExp= new RegExp( '(?:\s*)(?=[-|/])(?name\w*)[:|=](((?value.*?)(?!\\))|(?value[\w]*))'); var result : Object= r.exec( str ); result returns null... Maybe you can shed some light on what i am doing wrong here? Thanks... Karim ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] RegExp Help
I seem to be having some mixed results with this one: var tStr: String = '-path:c:\test path\temp -param spaced string -x' var patt: RegExp = new RegExp( '(?=[-{1,2}|/])(?Pname[a-zA-Z0-9]*)(?::|=)*(?Pvalue[\w|.|?|=||+| |:|/|\\]*)(?=[ |]|$)' , 'g'); var result : Object = patt.exec(tStr ); As it currently stands - it's not picking up Pvalue properly. it seems to be working in Grants RegExp tool. But am having issues picking up the groups in my code. This is my first attempt with RegExp, I guess it's not the easiest start. Maybe it would be better to write a parser for this one, but am curious to know if it can be done with AS3 RegExp. Cheers Karim On 13 Mar 2011, at 09:27, Karim Beyrouti wrote: This is great - thanks for explaining, helps a lot. the original expression I posted works this tool : http://gskinner.com/RegExr I would love to know what magic Grant is using to get it working in his RegExp utility. Thank you Anthony. On 11 Mar 2011, at 23:42, Anthony Pace wrote: Hi Karim and Ktu, Below is an explanation of what appears to be going on in the given pattern: (?:\s*) is a greedy non-capturing group of whitespace (?=[-|/]) is looking behind the next section of the expression, (?name\w*), for, what is in this case, a character set; as well, it does so without including it in the result. In this case the character set could also be written without the |, resulting in [-/] (?name\w*) is looking for name\w*, before the next expression [:|=] you may have wanted (?Pname\w*) [:|=] is a character set : or =, but again does not need the |, and could be [:=] or something like (?::|=) (((?value.*?)(?!\\))|(?value[\w]*)) is what I think you may have wanted to be an alternation, and in another language it would have worked; however, not in AS3. Apparently in AS3 in order to distinguish the syntax from a lookbehind ? you need to use the syntax ?PdesiredGroupName when defining a named group; as well, it is due to the fact that, as far as I know, in AS3 you cannot use names of the same group even a logical OR alternation. On 3/11/2011 2:37 PM, Ktu wrote: I just plugged it into RegExrhttp://www.regexr.com and I can't make sense of it. Try using that tool to build it. It really helps On Fri, Mar 11, 2011 at 5:56 AM, Karim Beyroutika...@kurst.co.uk wrote: Hello lovely list...I am trying to run a RegExp pattern on a String, and am not too sure why it's not working, and am not too sure why. Here is the code: var tStr: String= '/a:value -big=this -test:123 -test2=th_3' var r : RegExp= new RegExp( '(?:\s*)(?=[-|/])(?name\w*)[:|=](((?value.*?)(?!\\))|(?value[\w]*))'); var result : Object= r.exec( str ); result returns null... Maybe you can shed some light on what i am doing wrong here? Thanks... Karim ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Getting Data into my SWF
Hi Glen, If you really want to keep people from seeing some data until a certain date (depending on how sensitive it is), you should probably keep a pair of swfs instead of just serving up the one. You'd serve the pre-date swf before the event, then on the day of the event, you'd switch to serving the swf with the new data. That way no amount of snooping will allow a curious user to grab your restricted data, since you won't have served it up. Really, keeping the data off the user's machine is the only way to prevent them from accessing it. That said, some reasonable amount of obfuscation (funky named variables, encoded date info, etc.) could be used to at least make it less likely for novice snoopers to grab your restricted data. I'd only recommend that if the information is not terribly sensitive though. Kevin N. On 3/11/2011 4:53 AM, Glen Pike wrote: Okay, so it is possible to change the date using a sniffer, but being as the majority of people don't tend to use sniffers, unless the guy is writing a critical application that flies planes or crashes them if the date is wrong then I would suggest that the risk assessment here would be to accept the fact that there are some people there who might use a sniffer and change the date. if we all ran around with the attitude that you can't trust anyone, so what's the point, we would still be in the dark ages. On 11/03/2011 09:45, Henrik Andersson wrote: Glen Pike skriver: Hello, The parameters that you pass to the SWF in your HTML are different to communicating with a back-end system. If you look at URLLoader in actionscript. This enables you to load data as you would load a web-page. You would use URLLoader with your server-side code, e.g. PHP to do GET and POST type requests: This way, your users cannot inject their own date and it is also possible to have login type facilities. You clearly haven't heard of HTTP request sniffers. With something like Fiddler http://www.fiddler2.com/ I can easily override the reply from any server. And no, SSL does not help there. I can authorize any certificate authority I feel like, including my own one. And for any other checksum/validation I can always just edit the swf file to skip the check. In the end it is the same ages old trusted client problem. You just can't protect code that runs on the client. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Getting Data into my SWF
Wouldn't it also be helpful to have the server-side script verify (validate) the data the swf is sending back up? That way if someone manually triggered the date, the server would not accept it because it doesn't match it's system date. Don. On 3/11/2011 10:31 AM, John McCormack wrote: Kevin, On start-up the SWF could request the date of data transfer from a server script. The script would return it from the database in encrypted form to bypass sniffers. When the date is reached, and data requested, the PHP script could compare current server date and date from the database. If different, ignore it. Henrik's phrase You clearly haven't heard of HTTP request sniffers. is discouraging. We all make errors, unfortunately. On the other hand, he comes up with lots of useful information for which we are grateful. John On 10/03/2011 18:35, Kevin Holleran wrote: I'll explain further so I get valuable responses and avoid the sarcasm. My goal is to pass in the date from the server, the application counts down, and when the date hits a certain time, the application does something. This something that the application does will also be loaded by calling a PHP script that will load from a backend DB. My concern is someone being able to launch the SWF passing in an incorrect date that will trigger this something early. Thanks for your help. Kevin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders