我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

匹配字符串与preg_match [关闭]

I have the following string formats: "$ 3.20" or "$ 10.34". I want to verify with preg_match if the string is exactly this type of a format.

Any suggestions are appreciated?

Try this pattern:

if (preg_match('/\$\s[\d]+\.[\d]{2}/', $text)){
    //do something
}

近期文章

  • simplexml_load_file中的错误
  • JSON登录中的AJAX POST请求
  • 将数据从设备发布到服务器
  • 使用动态路径访问阵列
  • mysql从下拉列表中选择
  • 未找到请求的URL(FuelPHP)
  • 用另一个替换文件夹
  • PHP中的缩写排列
  • TOR隐藏服务:PHP会话
  • 通过URL参数进行SQL注入[重复]
  • 我怎么能做水平表?
  • 时区转换无效
  • 在UITableView中添加数组首尾处的UIbutoton
  • 复选框过滤无效
  • 下拉选择分页页面
  • Json编码自动完成源
  • 将db内容存储在数组PHP中
  • 替换字符串中的所有§
  • tinymce插件上传图片
  • PHP中的Flight Framework路由

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华