/ If where

Regex before a colon

I have this string:

[Provider].[Provider]=[ProviderArea].&[X12: WALES]

I want to grab just the X12 part.

I tried:

(?<=: )\w+(?=]$)

However, this only gets WALES.

I moreover tried:


But this gets the whole string before & including the colon.

Where am I going wrong?

If you wan’t to find word (`\\w+`) between `&[` & `:` then try maybe


  1. ^: ↩︎