M
Mmcolli00 Mom
Hi
Do you know how use a regular expression to get only the scripname from
the each filename below? I have long filename and I want to pull out a
segment "scriptname" only. I have been using a regular expression with
gsub for this.
filename
userfilename_scriptname_030109.txt
userfilename3_scriptname1_031109.txt
userfilename_scriptname0_031209.txt
The gsub didn't work because the _ on both sides causes me to delete the
whole filename. What would you recommend?
stripfirstpart = filename.gsub(/*_/,"")
stripsecondpart = filename.gsub(/_.*/,"")
Do you know how use a regular expression to get only the scripname from
the each filename below? I have long filename and I want to pull out a
segment "scriptname" only. I have been using a regular expression with
gsub for this.
filename
userfilename_scriptname_030109.txt
userfilename3_scriptname1_031109.txt
userfilename_scriptname0_031209.txt
The gsub didn't work because the _ on both sides causes me to delete the
whole filename. What would you recommend?
stripfirstpart = filename.gsub(/*_/,"")
stripsecondpart = filename.gsub(/_.*/,"")