1. <?php
  2. function makeTag( $string , $pattern )
  3. {
  4. preg_match_all($pattern, $string, $matches, PREG_OFFSET_CAPTURE);
  5. $text ='';
  6. foreach( $matches[0] as $znak )
  7. {
  8. $text.=$znak[0];
  9. }
  10.  
  11. return $text;
  12. }
  13. ?>



przyklad:
  1. <?php
  2. $string = 'to jest jakis string _ ktory ma znaki ^%@#$@#$!#!@#*^& specjalne :)';
  3. $pattern = '/([a-z_ ])/';
  4.  
  5. $text = makeTag($string , $pattern );
  6. ?>

rezultat:
  1. <?php
  2. $text = 'to jest jakis string _ ktory ma znaki specjalne';
  3. ?>



zna ktos latwiejszy sposob questionmark.gif

dziekuje