The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Removing a word from list of words
Hello All!
a dataset has 2 columns, one column has a list of words, I want to remove the last word including special characters(in this eg, [,.?]) is it possible?
Source data:
reg_no text
1 In,a,data,base,,,
2 at,palace,he,has,?,????,
required data:
reg_no text
1 In,a,data
2 at,palace,he
a dataset has 2 columns, one column has a list of words, I want to remove the last word including special characters(in this eg, [,.?]) is it possible?
Source data:
reg_no text
1 In,a,data,base,,,
2 at,palace,he,has,?,????,
required data:
reg_no text
1 In,a,data
2 at,palace,he
0
Best Answer
-
kayman Member Posts: 662 Unicorn@Anusha, use regex.
The idea is that you want to keep everything till the last comma followed by a word.^(.*),\w+.*
Not fully tested but it should do the trick.
use the replace operator with above snippet, and replace with $1
You can play with the regex here :
https://regex101.com/r/URTvjo/1
1