Regex to *not* match any characters

前端 未结 10 1650
一个人的身影
一个人的身影 2020-12-24 11:18

I know it is quite some weird goal here but for a quick and dirty fix for one of our system we do need to not filter any input and let the corruption go into the system.

10条回答
  •  情书的邮戳
    2020-12-24 11:32

    ^ is only not when it's in class (such as [^a-z] meaning anything but a-z). You've turned it into a literal ^ with the backslash.

    What you're trying to do is [^]*, but that's not legal. You could try something like

    " {10000}"
    

    which would match exactly 10,000 spaces, if that's longer than your maximum input, it should never be matched.

提交回复
热议问题