$query = 'this is a dentist';
$word = 'd';
$result = preg_replace("/\b($word)\b/ie", " ", $query);
//Result "this is a dentist"
$query = 'this is a bröd';
$word = 'd';
$result = preg_replace("/\b($word)\b/ie", " ", $query);
//Result "this is a brö"

Could anyone explain to me why the ö is treated as a whitespace? I really need support for åäö and want them to be treated as normal letters. This is probably very logical behaviour but I can't see it at the moment. :mad:

Is this something I can setup in php.ini or will we non-English-speakers always be doomed to eternal a-z-reprogramming? :/

    Maybe try adding the "u" modifier to treat the pattern as UTF-8?

      Thanks, pal, fascinated by this flag. :eek:

      If not considered rude asking this question, is it possible to apply this flag to for instance url_rewrite patterns aswell?

      Could I apply this to the code below?

      RewriteRule ^([+ÅÄÖåäöA-Za-z0-9-_,]+)/?$ index.php?id=$1 [NC,L]
      

        Afraid that's beyond the off-the-top-of-my-head level of knowledge. 🙁

          Undrium;10994177 wrote:

          Thanks, pal, fascinated by this flag. :eek:

          If not considered rude asking this question, is it possible to apply this flag to for instance url_rewrite patterns aswell?

          Could I apply this to the code below?

          RewriteRule ^([+ÅÄÖåäöA-Za-z0-9-_,]+)/?$ index.php?id=$1 [NC,L]
          

          I don't think so. (May be wrong.)

          are you trying to validate the url in any way, or are you just trying to copy the URL into the query string?

          this

          RewriteRule ^(.*)$ index.php?id=$1 [NC,L]

          would copy everything, including UTF-8 characters. This seems to be the common solution, though it might not be exactly what you're looking for.

            traq, that's very helpful, though. Thanks!

              Write a Reply...