2017-02-21 8 views
-2

文字列に二重引用符の後に引用符を置き換えます私は、文字列、次のしている

私は基本的に「外」の引用符を残すとにそれらの内部で引用符を変更するこの

<something="&quot;Some&quot; random string" somethingelse="Another &quot;random&quot; string"> 

にそれを変更する必要が

<something=""Some" random string" somethingelse="Another "random" string"> 

&quot;

私はこれを行うためにいくつかの正規表現が使われるかもしれないと思っていましたが、私はその論理がどうあるべきか分かりません。何か案が?

+0

を? – Fallenhero

+0

あなたは[ここの答えを見る](http://stackoverflow.com/questions/12290882/regex-to-escape-double-quotes-inside-double-quotes-with-preg-replace) –

+0

ちょうど\を置くあなたの引用をしたい、または一重引用符を使用する。 – Kornflexx

答えて

0

使用

例えば
echo '<something='.chr(34).'Some'.chr(34).' random string" somethingelse="Another "random" string">'; 

あなたはこの試みることができますので、あなたはまだ、yourseld何かをしようとしていないecho chr(34).'Some'.chr(34).' random string';

"Some" random string 

Ascii Table for Quotes and different elements

+1

あなたは何の質問に答えていますか? – Toto

関連する問題