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 }