Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

regular expressions and setting variables?



Hi folks:

I’m trying to emulate how iTunes changes some names of directories it creates based on names of artists.  For example, albums by the group R.E.M. are stored in a directory it creates called R.E.M_  

The final full-stop is replaced with an underscore, I assume to avoid complications in the unix filesystem.


This works:
  
 JUNK=R.E.M.
 print ${JUNK}| perl -p -e 's|\.$|_|g’

It returns
R.E.M_


But if I try to do this:  

print ${JUNK/\.$/_}   

it returns               
R.E.M.
 
I assume I am not using the correct regexp.  What do I need to do to get this working?

Thanks in advance.

Bill Scott






Messages sorted by: Reverse Date, Date, Thread, Author