Reply to Re: Regular expression help

Your name:

Reply:


Posted by Steve on 09/26/07 13:21

"Karin J" <k.x.jensen@googlemail.com> wrote in message
news:1190800981.199664.221350@19g2000hsx.googlegroups.com...
Hi everyone

I am using a ereg_replace to strip all but certain allowed characters
from a string:
$string = ereg_replace("([^ 0-9A-Za-zSOZsozYΐ-ΦΨ-φψ-ώ-])","",$string);

use preg. read the manual for an explanation.

I would like to extend this to allow HTML character references of the
form "&#number;" where number is the three or four digit code number
of the character. Examples would be "&#228;" and "&#7869;".

I am sorry but regular expressions hurt my brain!

as well as reading the manual. ;^) were you to have, you'd notice that you
would have been instructed to use preg rather than ereg for a miriad of
reasons. not only that, but you'd see an example of preg_replace doing
*exactly* what you're asking help on.

if regex hurts your brain, don't use it...you won't be able to maintain it
once you initially write it. it is a language in itself.

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация