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

否定完整的正则表达式[重复]

This question already has an answer here:

  • How to negate the whole regex? 3 answers

Forcing a certain url structure "type/name" and my working regex is:

([a-z]+\/?[a-z]+\/?)+

Now I want to remove all other characters from the string via preg_replace and therefore negate the pattern above. Simple cases like [^a-z] work fine but for my pattern I don't get it working by negating the whole pattern.

</div>

You can try this :

(?!([a-z]+\/?[a-z]+\/?)+)

近期文章

  • 在php中将字符串拆分为单词
  • 聊天管理员不同颜色?
  • PHP json_encode将字符串转换为null
  • PHP多线程 - 安全吗[关闭]
  • MySQL函数给出错误的值
  • 如何获得前一年的PHP?
  • 这个正则表达式PHP代码有什么问题?
  • PHP json_encode不编码...为什么?
  • 清理和验证表单php
  • index查索引值总报错,求大佬们帮忙看看
  • 插入字符串时缺少前导零
  • 显示数据库中的所有数据行
  • 如何将我插入的密码与php中的md5哈希进行比较
  • 如何在Fat-Free Framework中显示自定义401页面?
  • 在我的javascript中通过ajax接收php数据作为数组而不是responseText
  • 用php动态设置输入值
  • php从明年代码开始循环播放
  • 超薄路由无法在服务器上运行
  • 1小时后执行查询
  • Google图表中的PHP字符串连接

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华