ユーザの入力からキーボード以外の文字をすべて削除しようとしていますが、これを実現するために苦労しています。次の正規表現は、複数の文字を置き換えるものではなく、ただ1つ... /i
の代わりに末尾に/ig
を追加しようとしましたが、認識されないフラグとして壊れます。私も*
と他のさまざまな組み合わせを使用しようとしましたが、それを理解できないようです。このテキストに対して正規表現以外のキーボード文字を削除する
$data = preg_replace('/[^a-z0-9<>\s\!\@\#\$\%\^\&\*\(\)\_\+\-\=\{\}\[\]\|\\\:\;\"\'\?\/\>\.\<\,\®]/i', '', $data);
テスト:私は私の最初の答えに何かを混ぜ
Nutritional counseling <br /><br />Online Clinic Visits except as specifically covered in the Certificate or EOC. ÂÂ<br /><br />Health club memberships <br /><br />Any services to the extent you are entitled to receive Medicare benefits for those services without payment of additional premium for Medicare coverage <br /><br />Food or dietary supplements, except, as specifically stated in the certificate or EOC or as required by law <br /><br />Genetic testing for nonmedical reasons or when there is no medical indication or no family history of genetic abnormality <br /><br />Outdoor treatment programs <br /><br />Replacement of prosthetics and durable medical equipment when lost or stolen <br /><br />Any services or supplies provided to any person not covered under the Agreement in connection with a surrogate pregnancy <br /><br />Immunizations solely for travel outside the United States <br /><br />Services or supplies related to a pre-existing condition <br /><br />Educational services except as specifically provided or arranged by Anthem Blue Cross <br /><br />Infertility services (including sterilization reversal and costs associated with the storage of sperm, eggs, embryos and ovarian tissue) except as specifically stated in the certificate or EOC <br /><br />Care or treatment provided in a noncontracting hospital <br /><br />Private duty nursing except as specifically stated in the certificate or EOC <br /><br />Services primarily for weight reduction except medically necessary treatment of morbid obesity <br /><br />Outpatient drugs, medications or other substances dispensed or administered in any outpatient setting <br /><br />Contraceptive devices unless your physician determines that oral contraceptive drugs are not medically appropriate. <br /><br />Vein Treatment: Treatment of varicose veins or telangiectatic dermal veins (spider veins) by anyÂÂ method (including sclerotherapy or other surgeries) when services are rendered for cosmetic purposes. <br /><strong><br />Third Party Liability</strong> - Anthem Blue Cross is entitled to reimbursement of benefits paid if the member recovers damages from a legally liable third party. <br /><br /><strong>Coordination of Benefits</strong> - The benefits of this plan may be reduced if the member has any other group health, dental, prescription drug or vision coverage so that the services received from all group coverages do not exceed 100% of the covered expense.<br />
私の知らないこと、私はすべての文字がキーボードで入力できると思いますか? – ajreal
おそらく英数字以外の文字を意味するでしょうか? –
可能な複製:http://stackoverflow.com/questions/1401317/remove-non-utf8-characters-from-string – piddl0r