title: Istio Ingress Regex Negation
body: <p>I'm using Kubernetes with Istio which comes with traffic management. All backend api endpoints starts with <code>/api/**</code> followed by specific uri except frontend service. Frontend service has no any general uri prefix.</p>
  
  <p>What i want to achieve is in the istio <code>VirtualService</code> use a regular expression that basically says, if a requested uri does not start with <code>/api/</code>, let it be served by frontend-service.</p>
  
  <p>This is my <code>VirtualService</code></p>
  
  <pre><code>apiVersion: networking.istio.io/v1alpha3
  kind: VirtualService
  metadata:
    name: {{ .Release.Name }}-frontend-ingress
    namespace: default
  spec:
    hosts:
    {{ include "application.domain" . }}
    gateways:
    - iprocure-gateway
    http:
    - match:
      - uri:
          regex: '^(?!\/api\/).*'
      route:
      - destination:  
          host: {{ printf "%s.%s.svc.cluster.local" .Values.frontendService.serviceName .Release.Name }}
          port:
            number: {{ .Values.frontendService.service.port }}
  </code></pre>
  
  <p>What is the <code>regex</code> value that I can use to make all request that does not start with <code>/api/</code> be served with frontend-service</p>