dongxie3352 2018-05-31 16:27
浏览 31


i have this preg_match, but i can't understand why, it is evaluating for spaces:


i want to verify if there is any of those characters but allowing the spaces, sorry i am no so good with regex, i know that the space in regex is \s, thank you in advance.

  • 写回答

1条回答 默认 最新

  • dongtun1683 2018-05-31 16:39

    The \0-9 is not making a range of numbers. Use \d or 0-9, without the backslash. You also don't need to escape the double quote, and you only need to list each character once, > and ^ were listed more than once. If you were trying to pair them with the preceding character that won't work. You could use an optional grouping for that (this|that). Every character in a character class is individual with the exception of ranges (and because of that be careful with the -).

    This should function as you expect your current regex to:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥20 画CAD几张图片内容如下1111111111111111111111111111111111111111111
  • ¥15 基于python的电影系统推荐
  • ¥20 springmvc重定向和返回json
  • ¥15 数学建模——参会安排怎么做
  • ¥15 电脑键盘实现触摸功能
  • ¥25 matlab无法将表达式转换为双数组怎么解决?
  • ¥15 单片机汇编语言相关程序
  • ¥20 家用射频美容仪技术规格
  • ¥15 大家帮我看看为什么错了
  • ¥15 unity互动琴弦抖动效果