0

My string looks like below. I want to get Completed from below string.

"Completed[TranslationTest]"

I want any text which is not in square bracket.

I.B
  • 2,925
  • 1
  • 9
  • 22
GPK
  • 137
  • 1
  • 1
  • 11

1 Answers1

0

Making some assumptions here, what type of chracters can be inside those brackets, but basically what you want is a something followed by positive lookahead group, like this: \w*(?=\[[\w\W]*\])

Avo Nappo
  • 620
  • 4
  • 9
  • You could always use `[^\[\]]*(?=\[.*?\])` and just assume that any character is valid inside the brackets and assume that any character except for brackets if valid outside them. – ctwheels Sep 19 '17 at 18:42
  • Yep, that's cleaner than mine :) – Avo Nappo Sep 19 '17 at 18:50