Ask Your Question
0

regsubst not replacing all occurences

asked 2016-07-12 12:58:25 -0500

puppetamateur gravatar image

I have the following code:

   $folder_base = "E:/apps"
   $folder = "tommy"
   $merge = "${folder_base}/${tommy}"
   $reg = regsubst ("${merge}", "/","\\")

the output is supposed to be => e:\apps\tommy

instead it comes out as => e:\apps/tommy

please help

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-07-12 16:00:01 -0500

lupin gravatar image

You need the 'G' flag. $reg = regsubst("${merge}, "/", "\\", 'G')

edit flag offensive delete link more

Comments

what is a 'G' flag?

puppetamateur gravatar imagepuppetamateur ( 2016-07-12 16:43:30 -0500 )edit

Global - replaces all occurrence of a match.

lupin gravatar imagelupin ( 2016-07-19 04:08:45 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-07-12 12:58:25 -0500

Seen: 28 times

Last updated: Jul 12 '16