RegEx: inserting space in text
- 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
I am trying to insert a space in my text in the column 'CountyX'. How can I do that with RegEx? Can someone help me please?
Solved! Go to Solution.
- Labels:
- Parse
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Kwaku_Od ,
Can you provide a sample input and a desired output, as from the provided screenshots it's hard to tell what you're trying to do. Are you trying to add a space before the second capital letter in your CountyX column?
EDIT : If that's the case and County is present and appears last in all your records, you can try replacing that very text with a space and then add the string "County" after it. No need to use a regex tool, a formula tool will do it.
Thanks,
Angelos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Kwaku_Od
An equivalent regex would be
regex_replace([Field1],"(.*?)(County)","$1 $2")
If you're using the Regex tool
If you're modifying the input string directly, remember to increase its length using a select so you don't end up dropping the "y" from "County"
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Angelos,
Thanks for your help. So I am basically trying to remove the "Total" at the end of this string. That is why I ended up using the multistep approach. Is there a way I could use RegEx to delete it directly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for your help Dan! How do I modify the code to remove a specific word "Total" in the string?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Kwaku_Od
Why not just use replace function like this
Replace([County], " Total", "")
Hope this helps : )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Kwaku_Od
Can you provide some sample input and expected output it will help us get a better understanding of the usecase. I will try to provide you a solution early as possible 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you ! This worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Happy to help : ) @Kwaku_Od
Cheers and have a nice day!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for the simpler solution, @atcodedog05!
