how to Extract String Value after final space
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi, I have a STRING text of stock class information. I want to extract all the text digits or string alike after the final space. How do I do this? The Solution that I'm seeking to replicate is in the column Final Class.
1) I'm able to use the Formula tool: Right([Name],FindString([Name],' ')) and extract some of the data from the right but it's not after the final space.
2) I used a data cleansing tool to remove leading and trailing whitespace
3) Run another Formula Tool: GetRight([EXTRACT_CLASS], " ") but I still can't get results to look like the values in Final Class column.
There might be a regex tool solution but I haven't figured it out as I'm a bigger to regex and parsing such complicated string text.
Thank you!
Solved! Go to Solution.
- Labels:
- Help
- Preparation
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Bren_Spill Thank you! your solution worked. Could you explain to me what the expression is doing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
.*\s matches zero or more of any single character up until the whitespace. When the expression encounters the whitespace character, it backtracks to find the last occurrence of a space.
The final .* returns the remainder of the string - this section must be placed in ( ) to create a marked group which will appear in the Output Columns section of the Regex tool
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you!
