Asked  7 Months ago    Answers:  5   Viewed   48 times

How can I use preg_match to see if special characters [^'£$%^&*()}{@:'#~?><>,;@|-=-_+-¬`] exist in a string?

 Answers

98

[W]+ will match any non-word character.

but to match only the characters from the question, use this:

  $string="sadw$"
  if(preg_match("/[[^'£$%^&*()}{@:'#~?><>,;@|\-=-_+-¬`]]/", $string)){
   //this string contain atleast one of these [^'£$%^&*()}{@:'#~?><>,;@|-=-_+-¬`] characters
  }
Wednesday, March 31, 2021
 
hillz
answered 7 Months ago
20

Changed the HTML charset to ISO-8859-1 fixed the problem! Silly

Wednesday, March 31, 2021
 
Sujith
answered 7 Months ago
86

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario: http://confluence.jetbrains.com/display/PhpStorm/PHPUnit+Installation+via+Composer+in+PhpStorm

Related usability ticket: http://youtrack.jetbrains.com/issue/WI-18388

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
 
ojrac
answered 7 Months ago
79

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Saturday, May 29, 2021
 
Nate
answered 5 Months ago
43
  1. Make sure you set the headers to UTF-8:

    header('Content-Type: application/json; charset=utf-8');
    
  2. Make sure your connection to database is made with UTF-8 encoding before any queries:

    $query = mysql_query("SET NAMES 'UTF8'");
    
  3. As far as I know, JSON encodes any characters that cannot be represented in pure ASCII. And you should decode that JSON on response.

  4. Try to move to PDO as mysql_* functions are deprecated. Use this nice tutorial

Saturday, May 29, 2021
 
kwhohasamullet
answered 5 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :