Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use regular expression in a gsub

Status
Not open for further replies.

cmartins

Technical User
Oct 16, 2001
8
BR
Hello

How can I use a regular expression in the gsub function.
I want to change from lower to upper case without use "toupper"

something like this did not work:
gsub(/[a-z]/,/[A-Z]/)


Is there a way to do it ?
Regards
Claudemir F Martins
 
You can only use a regular expression in the search string, in the replace string it is just a character string. I can't think of a way to do what you want using gsub(). You will either have to get over your distaste for toupper or write a loop to test and modify each character. CaKiwi
 
Try gensub and toupper for a little more selectivity if that is the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top