zsh-users
 help / color / mirror / code / Atom feed
* regular expressions and setting variables?
@ 2014-06-10  5:02 William G. Scott
  0 siblings, 0 replies; 6+ messages in thread
From: William G. Scott @ 2014-06-10  5:02 UTC (permalink / raw)
  To: zsh-users

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





^ permalink raw reply	[flat|nested] 6+ messages in thread
* regular expressions and setting variables?
@ 2014-06-10  5:04 William G. Scott
  2014-06-10  6:17 ` Roman Neuhauser
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: William G. Scott @ 2014-06-10  5:04 UTC (permalink / raw)
  To: zsh-users

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-10 14:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-10  5:02 regular expressions and setting variables? William G. Scott
2014-06-10  5:04 William G. Scott
2014-06-10  6:17 ` Roman Neuhauser
2014-06-10  8:45 ` Phil Pennock
2014-06-10 14:26   ` William G. Scott
2014-06-10 14:11 ` zzapper

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).