I want to delete all characters after the "[" character like the screenshot below:
How do I achieve this?
I want to delete all characters after the "[" character like the screenshot below:
How do I achieve this?
Input examples from the provided screenshot:
The easiest way would be to split the column on the separator [
and delete the second column.
The more elaborate way would be to use a regular expression:
value.replace(/\s\[[^\]]+\]/, "")
Play around with https://regex101.com/ or https://regexr.com/ to find out more about how this regular expression works.
if you want to skip regex complexity, I will use the split function value.split('[')[0]
The split() function create an array, and the [0]
selector pick the first value of the array.