<?php
$tagsText = '#ラーメン #カレー # aaaaaaaa bbbbbbbb #カツ丼 #シチュー #肉じゃが cccccccc';
$result = preg_match_all('/#([^\s#]+)/', str_replace(' ', ' ', $tagsText), $m) ? $m[1] : [];
print_r($result);
// 結果 [ラーメン, カレー, カツ丼, シチュー, 肉じゃが]
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00