0

I have a cell in E13 which contains numbers and numbers between brackets. What I want to acheive is to match the number and copy to another cell and delete the match from E13.

E13

0:08.63 [6]

I want E13 to be

0:08.63

And in M13 I want

6

Based on this example https://support.google.com/docs/answer/3098244?hl=en

=REGEXEXTRACT(A4, "\(([A-Za-z]+)\)")

I tried this in M13

=REGEXEXTRACT(E13,\([[0-9]+]\))

Then based on this SO answer https://stackoverflow.com/a/2403159/461887

=REGEXEXTRACT(E13,\[(.*?)\])

But in both cases I just get an error.

sayth
  • 6,338
  • 11
  • 52
  • 95

2 Answers2

2

You are just getting a basic syntax error. Have you actually read the minimal help for REGEXEXTRACT? It provides a clear example that the regexp must be enclosed in double quotes. Your second expression works correctly then:

=REGEXEXTRACT(E13,"\[(.*?)\]")
ttarchala
  • 3,784
  • 2
  • 24
  • 33
2

SPLIT by the space:

=SPLIT(E13," ")

REGEX:

=REGEXEXTRACT(E13,"(\S+)\s+\[(\d+)\]")
TheMaster
  • 37,620
  • 6
  • 43
  • 68