1

Kimonolabs have three part regular expression which looks like this:

/^()(.*?)()$/

First part is what preceeds desired text, middle part is the text you want and the third part is what follows desired text.

The text I have is

"[USA] John Doe"

So I guess, this simple regex should give me what I want:

/^(\] )(.*?)()$/

But it doesn't. Even when I try be more specific like this:

/^(\[[A-Z]{3}\] )(.*?)()$/

I guess it is not about the actual regex, but more how Kimonolabs regexes work.

maxav
  • 11
  • 1

1 Answers1

1

The regex that you specified will not match your desired input. The ^ at the beginning means that your line should start with the group that follows so in your case you would be expecting the line to start with a ].

To make your pattern matching either:

  • get rid of the ^ (which kimono probably does not allow you to do)
  • or use this regex: /^(.+\] )(.*)$/ which matches some characters followed by a ]
k-nut
  • 3,447
  • 2
  • 18
  • 28
  • hm, it looks as if the last regex that you specified should work in that case though... Maybe you can provide some more information (like the page that you are trying to match) – k-nut Jul 11 '15 at 12:44
  • Thank you for answer. In fact, you are right, last regex works. Don't know why it haven't worked before. But I still don't get if the first / last part of regex must _exactly_ match the text. – maxav Jul 12 '15 at 19:08