J
J
jeffer_fl7p2018-11-02 14:47:33
Unicode
jeffer_fl7p, 2018-11-02 14:47:33

Question marks output in php when using preg_match?

I am writing code in Atom, the regular expression should take a hashtag from a long text. There is a string with a hashtag: #Hello, it returns: #Hi
$item->text - a string,

mb_internal_encoding("UTF-8");
  preg_match('/#[а-яА-Я0-9]+/', $item->text, $foundResult);
  print_r($foundResult);
  echo '<div class="fillTitle">' . $foundResult . '</div>'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stimulate, 2018-11-02
@jeffer_fl7p

preg_match('/#[а-яА-Я0-9]+/u', $item->text, $foundResult);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question