Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
「$ 3.20」または「$ 10.34」という文字列形式があります。文字列がまさにこのタイプの形式であるかどうかを preg_match で確認したいと思います。
何か提案をいただければ幸いです。
このパターンを試してください:
if (preg_match('/\$\s[\d]+\.[\d]{2}/', $text)){ //do something }