How should the regular expression match data similar to xf0x9fx91xab? How should I match the regular expression \ xf0 \ x9f \ x91 \ xab. Please help! How to write an expression ??
Reply to discussion (solution)
$s = "\xf0\x9f\x91\xab";var_dump(preg_match('/\xf0\x9f\x91\xab/', $s));
$s = "\xf0\x9f\x91\xab";var_dump(preg_match('/\xf0\x9f\x91\xab/', $s));
Then you can only match one. This is only one of them.
$s = "\xf0\x9f\x91\xab";var_dump(preg_match('/\xf0\x9f\x91\xab/', $s));
Then you can only match one. This is only one of them.
Please post all content that needs to be matched !!
$s = "\xf0\x9f\x91\xab";var_dump(preg_match('/\xf0\x9f\x91\xab/', $s));
Then you can only match one. This is only one of them.
Please post all content that needs to be matched !!
For example, Hello, \ xf0 \ x9f \ x98 \ x83. today I am very \ xf0 \ x9f \ x86 \ x93. This binary is uncertain.
If your string is UTF-8, I guess it is correct. \ xf0 \ x9f \ x98 \ x83 and so on are separators. the entire string should have only several forms, each of them should be considered as a single character (no word, only occupying space, separator)
If your string comes from an API, you 'd better check the API documentation.
I have already said this in your other post. Unfortunately, your understanding is too bad.
Rule string: // \ xf0.0 .../
$ S = "this is only the test text \ xf0 \ x9f \ x98 \ x83 in the program. In fact, the emoticons are represented by the internal code \ xf0 \ x9f \ x86 \ x93. "; Preg_match_all ('/\ xf0... /', $ s, $ r); foreach ($ r [0] as $ v) echo current (unpack ('H *', $ v), PHP_EOL;
F09f9883
F09f8693
I have already said this in your other post. Unfortunately, your understanding is too bad.
Rule string: // \ xf0.0 .../
$ S = "this is only the test text \ xf0 \ x9f \ x98 \ x83 in the program. In fact, the emoticons are represented by the internal code \ xf0 \ x9f \ x86 \ x93. "; Preg_match_all ('/\ xf0... /', $ s, $ r); foreach ($ r [0] as $ v) echo current (unpack ('H *', $ v), PHP_EOL;
F09f9883
F09f8693
Well, now I want to implement it using your method.
$ Text = "this is only the test text \ xf0 \ x9f \ x98 \ x83 in the program. In fact, the emoticons are represented by the internal code \ xf0 \ x9f \ x86 \ x93. "; // Callback function call ($ matches) {return" [emoji] ". bin2hex ($ matches [0]). "[/emoji]";} echo preg_replace_callback ("| \ xf0... | "," call ", $ text );