apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: regex-extsvc
  namespace: testns
spec:
   hosts:
   - regex.extsvc.com
   ports:
   - number: 9003
     name: http
     protocol: HTTP
   resolution: STATIC
   endpoints:
    - address: 127.0.0.2
      ports:
        http: 8080
      labels:
        version: v1
    - address: 127.0.0.3
      ports:
        http: 8081
      labels:
        version: v2
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: regex
  namespace: testns
spec:
  host: regex.extsvc.com
  subsets:
    - name: v1
      labels:
        version: v1
    - name: v2
      labels:
        version: v2
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: regex-route
  namespace: testns
spec:
  hosts:
    - regex.extsvc.com
  http:
    - match:
      - headers:
          foo:
            regex: "b.*"
        sourceLabels:
          version: v1
      route:
      - destination:
          host: regex.extsvc.com
          subset: v2
        weight: 100
    - route:
      - destination:
          host: regex.extsvc.com
          subset: v1
        weight: 100
