RegEx Trouble

Trying to make a very simple Regular Expression, having a tough time with it. I'm moderately experienced with RegEx, but by no means a pro.

Example string:

flashback rise [bump out @ 01:03:11:05]

desired string:

flashback rise

Currently, using Action "Search and Replace System Clipboard Using Regular Expression (ignoring case)
Search System Clipboard
for Regular Expression (ignoring case)

 [[].*[]]

and replace with:

In external RegEx testers, I'm getting the brackets, all enclosed text, and the preceding space to all match, but not so in Keyboard Maestro. What am I doing wrong here? Thanks in advance for the help!

I think that this will work:

^.*?(?=\s\[)

Thanks Jim! That nearly works, in that it in practice appears to keep only the characters that I wish to remove - in this instance generating

[bump out @ 01:03:11:05]

rather than

flashback rise

But also, why do all these tokens look totally foreign to me?

Sorry—I had it backwards. This should work:

\s\[.*?\]

(the above are not Keyboard Maestro tokens, they are Regular Expression characters)

[] matches anything inside it. So if you put nothing inside it, it is meaningless in the RegEx expression. If you need to match a literal [, you need to escape it: \[.

This is another way:
image

(.+?) \[

Note, there is a space between ) and \ (assuming you don't need the space in your result).

Thanks all, this is massively helpful!

To be more precise they are regex meta-characters, and they are often referred to as tokens.

-Chris