1

I'm trying to create a formula that uses either =REGEXEXTRACT or =REGEXREPLACE to remove all characters not inside [brackets] but leaving the ,,, commas where they are.

For example...

➜ Text to Regex:

Checkbox 1, Checkbox 2, Checkbox 3[checked], Checkbox 4[disabled]

✔ Expected Result:

, , checked, disabled



My broken formula so far is...

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

✖ Current Result:

checked


Does anyone know the correct way to achieve this?


UPDATE

I created this Google Sheet to show the current work: https://docs.google.com/spreadsheets/d/1UEO22NB9O6hvbTQzIa2YlMys1GF7ZBpe8aVzmX7dOnk/edit#gid=0

4
  • 1
    ,,,,,,,,, Done.
    – Oneezy
    Mar 10, 2018 at 8:50
  • 1
    It's a part of the Google Font directory I believe. One of my favorite fonts
    – Oneezy
    Mar 10, 2018 at 9:51
  • Can you please also update the Google Forum Post, to have this answer? Mar 13, 2018 at 12:21
  • 1
    Done. @JacobJanTuinstra
    – Oneezy
    Mar 23, 2018 at 3:57

1 Answer 1

2
+200

Try

=REGEXREPLACE(A2,"\w+\s*\d*\[?(\b\S+\b)?\]?(,?)(\s*|$)","$1$2")
4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.