Regex tool to separate after 1st hyphen
- 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 all,
I using this syntax " ^(\d+)\s-\s(.+)$ " in the Regex tool (Parse) to separate data after first hyphen like below:
Col1 Col2 Col3
31055 - Multiple Costs 31055 Multiple Costs
however anywhere in my numbers is is decimal the values coming as null like below
Col1 Col2 Col3
30144.4 - Purchase Costs Null Null
Desired output:
Col1 Col2 Col3
30144.4 - Purchase Costs 30144.4 Purchase Costs
kindly help in getting the desired result my modifying or with new syntax in the Regex tool
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
HI @RajatRehria , here are a couple of ways to do it. In the Regex tool I've sorted out your formula - you needed to account for the possible full stops in the numbers. I've also given an example of using Text-to-Columns to do the same job. Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @FinnCharlton for the solutions.
