On Tue, 07 Sep 2004 22:43:10 +0200, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > [ Please type your reply *below* the quoted part of the message you > are replying to. ] > > Chris Welch wrote: > > Gunnar Hjalmarsson wrote: > >> Chris Welch wrote: > >>> I have a dilemma, I am processing CGI forms and I need to come > >>> up with a regex that will accept HTML entities (i.e., " or > >>> {), > >> > >> Your description makes me fear that you are somewhat off track. > >> *Why* would you need such a regex? > >> > >> If you explain more about the context, it would be easier to > >> advise. > > > > Basically I am going to turn some funny characters into HTML > > entities using the aforementioned HTML::Entities so I can display > > them in a HTML page. I therefore need to accept them, but also the > > other chars. > > I can understand that you want to validate the other ("funny") > characters, but I don't understand why your validation regex would > need to include HTML entities. Isn't HTML encoding something *you* do, > before display but after validation? > > > As far as I am aware HTML::Entities will only turn characters into > > their HTML entity equivalent and vice versa, depending on the > > function used, correct? > > Yes. > > > > -- > Gunnar Hjalmarsson > Email: http://www.gunnar.cc/cgi-bin/contact.pl > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > >
Apologies for posting above the text... Right the deal is thus - if I am getting the wrong end of the stick, feel free to beat me over the head with said stick. I have a form and someone submits weird stuff that probably shouldn't be in there (but you never know.) This has to be writted to a DBM database/ filehandle. The weird stuff needs to be displayed in a HTML page when the DB entry or file is read, however, to ensure that it is not malicious I want to change it into an entity that's not going to do anyone any harm, so I use HTML::Entities. However, if there are things in there that HTML::Entities *can't* convert (doesn't it only deal with characters that have a named entity like & rather than ones that just have numbered entities?) then I want to throw an error. Hence my list of acceptable characters *plus* entities being allowed. >From your replies it seems I could be trying to do something that I don't necessarily need to - if so do you have any other suggestions as to what would be a better way in your opinion? Again - thanks for your help. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>