I'm learning spring-cloud-gateway, when I practice predicates
, I want to try some regex like followings:
spring:
cloud:
gateway:
routes:
- id: after_route
uri: http://www.google.com/
predicates:
- Cookie=token, hello*
I think hello*
will matches hello
,helloa
,helloaaaaa
..., but when I test by curl --cookies ...
, it only matches hello
, why helloa
and helloaaaaa
does not matches correctly?
Does regex in spring cloud application.yml need some changes?
I doesn't have anything to do with yaml or gateway just java regex
"helloaaaa".matches("hello*") // returns false.
But this works
"helloaaaa".matches("hello.*") // returns true.
Patter javadoc says X* matches X, zero or more times
So your regex would match "hellooooo"
"hellooooo".matches("hello*") // returns true.