0

開始位置で文字列内のhtmlタグを取得し、文字列から削除したい

私のデモ文字列は以下の通りです:

<I>little willingness</I> that, as the Course itself was to emphasise

<I>これはタグを o/p として返します

<p>little willingness</p> that, as the Course itself was to emphasise

<p>これはタグを o/p として返します

little willingness that, <p>as the Course itself was to emphasise</p>

これにより、o/p として null が返されます

以下のコードを変更して、行頭の HTML タグのみをチェックしてから削除するにはどうすればよいですか?

preg_match("/<[^<]+>/",$string,$m);
4

2 に答える 2