eZ Community » Forums » Setup & design » Manipulate string with regexp?
expandshrink

Manipulate string with regexp?

Manipulate string with regexp?

Monday 11 December 2006 3:06:45 pm - 2 replies

Hi!

<b>Short version:</b>
Is there any way to use regexp to manipulate text strings (e.g. <i>$nick =~ s/[^a-zA-Z0-9]+//g</i>blunk.gif Emoticon in eZ? If so, how?

<b>Long version:</b>
I'm setting up a chat section on our community site, using CGI::IRC and a local installation of ircd-ratbox. I want my users to have the same nickname both in eZ and on irc, and to do that, I generate the login-form from CGI::IRC myself, putting the eZ username (not the user account-username, but a normal text line-field (in order to allow more dynamic usernames)) in a hidden form-field. (The users are not allowed to alter nicknames on IRC, by restrictions in CGI::IRC and ratbox)

The problem is that since our username-field allows special characters (~ > < _ %" etc), the login to irc fails.

So, I need to strip of the special characters (<i>$nick =~ s/[^a-zA-Z0-9]+//g</i>blunk.gif Emoticon . There is a theoretical possibility of doing this in IRC::CGI after the form is submitted, but if eZ can handle it, that would be easier.

Any ideas on how this could be done?

Monday 11 December 2006 4:44:20 pm

Hi Eivind

Did you try the reg ex replace contribution: http://ez.no/community/contribs/template_plugins/reg_ex_replace ?

Monday 11 December 2006 7:11:42 pm

ah, works great! thanks for the tip, and sorry I missed that page when searching.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu