Expression to extract text in a string to the right after a dash character
I need to extract text in strings (product labels) after a dash character. An example string: Pavé Nameplate Necklace - "ADHD". Ideally, the result would be ADHD, but "ADHD" works as well, since I will use the extracted text to sort alphabetically.
I'm avoiding extracting text between quote marks since many of the label-strings have inconsistent straight-quote marks and smart-quotes marks --but maybe an expression can account for the different quote mark styles.
Thanks in advance!
Bob
33 replies
-
try:
replace(substr(YourTextField, index('Text 2', "-") + 1), """", "")
-
This works great when the labels have straight-quotes, but sometimes there are smart-quotes (curled marks). Is there a way to cover for both to avoid editing hundreds of labels?
-
This is sooo close. Definitely solved the left curly quote, but there are also a few right curly quotes.
-
This one-liner works with the example given.
extractx(YourTextField, "(?:""|“)(\w+)(?:""|”)", "$1")
Content aside
- Status Answered
- 8 mths agoLast active
- 33Replies
- 399Views
-
5
Following