Using the replace operator to convert lowercase to uppercase
Hello, I am trying to use the replace operator to replace all lowercase letters in the values belonging to an attribute, with their uppercase counterparts. My "replace what" regex expression is working (it is [a-z] ), but my "replace by" expression ( [A-Z] ) simply replaces every lowercase character with "[A-Z]", not the uppercase version of the character it is supposed to replace. What is the correct regex expression for the replace by parameter to replace the characters with their uppercase versions?
Thanks!
Best Answer
-
kayman Member Posts: 662 Unicorn
Not sure if I understood the problem correctly, but if you simply want to uppercase all values for a given attribute the easiest way is to generate a new attribute, give it the same name and replace it with upper([name_of_attribute]).
As far as I know this cannot really be done with regex in RM.
3
Answers
Did you read this KB article? https://community.rapidminer.com/t5/RapidMiner-Studio-Knowledge-Base/Data-Cleansing-Tips-How-to-Rename-Attributes-to-Lower-Case/ta-p/45193
It might be helpful to you.
Thanks, but I am surprised that I need to write a groovy script to do this very simple task - I saw another thread that said it can be done with a replace and regular expressions.
I am trying to do a global search and replace letters in the values that belong to an attribute from lowercase to uppercase, not the attribute itself. I think I could just do it easier in pandas rather than learn groovy.
It seems like a straightforward thing to want to do, as the join operator is case sensitive.
Thanks so much, this worked like a charm! Exactly what I wanted to do.
hello @christina5 - another approach for future knowledge is to use the Text Processing extension and use the "Transform Cases" operator.
Scott
Transform cases is not very friendly, requires a to run through Process From Data operator to convert to doc and then back again.