jeudi 12 décembre 2019

how to extract all #Tags and User tag from string in laravel?

I have an input field where Username Tage like @abd123,@abc1, and some Topic Tags like #CurrentNews,#NewLife on same input field.

here my job is to catch all tagged name that starts with @ and # and put on separate array for a look into their DataBase table. so it being very complicated for me. so please tell me the easiest solution.

it's before I used explode() method for this. but it was not a good idea.

the value i am getting like this way from request

$allTags =  @abc1,@abvc321, #NewAge , #CurrentNews

it should be after process.

$userTag = ["@abc1","@abvc321"];
$topicTag = ["#NewAge ","#CurrentNews"];


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire