|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
How would I search for odd charecters such as: Ü, ê, §, ù, ƒ, Â, ö, ñ, ê, etc.
On my website I try to filter out "bad" words and asterick "*" them out, but the users are getting smarter using such charecters as the above. |
|
#2
|
|||
|
|||
|
$message =~ s/[^W]/*/ig;
That would change all non-alphanumeric (a-z, A-Z, 0-9, underscores and spaces) to an asterix. |
|
#3
|
|||
|
|||
|
That would work, but I only want to asteric out certain words, ie: ****, bitch, *** hole, etc. I want to be able to leave things like: Thê §øù£ øƒ Ân Åñgê£ since it doen't contain swear words.
|
|
#4
|
|||
|
|||
|
Heh, well to bad. You can't have a regular expression filter out bad words and odd characters at the same time (unless you can think of every possible combination of swear words with those characters.
|
|
#5
|
|||
|
|||
|
Lets just say I wanted to filter out one particular word like: pÜssy (the one I am tring to filter out), how can I write a query to recognise this?
|
|
#6
|
|||
|
|||
|
This is what I do to remove unwanted words in variable:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> $FORM{'text'} =~ s/pÜssy//g; $FORM{'text'} =~ s/www//g; $FORM{'text'} =~ s/internet//g; [/code] |
|
#7
|
|||
|
|||
|
The problem is that
$FORM{'text'} =~ s/pÜssy/p****/g; does not work. This is the way that I do search for "bad" swear words, but the "Ü" seems to mees things up. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > searching for odd charecters |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|