Re: Basic string replacement

2010-03-08 Thread Les Mikesell
On 3/8/2010 10:31 AM, Daniel V Klein wrote: > Les- > > I think you may have missed my core point. The issue is not library versus > you, or anything like that. A declarative language says "what will be", and > does not change what already satisfies that. Additionally, getting to the > stage of "

Re: Basic string replacement

2010-03-08 Thread Daniel V Klein
Les- I think you may have missed my core point. The issue is not library versus you, or anything like that. A declarative language says "what will be", and does not change what already satisfies that. Additionally, getting to the stage of "what you want" may take a few cycles. Just looking at

Re: Basic string replacement

2010-03-05 Thread NWatson
CF does what it does and does it well whether it is programming language or not. It is definitely not like a scripting language and because of this I often find I have to alter my approach to promises. My mind tries to rely on its experience with shell and perl scripts but those methods don't

Re: Basic string replacement

2010-03-05 Thread Les Mikesell
daniel.kl...@cfengine.com wrote: > Because it is a declarative promise language - which is somewhat different > than the usual imperative programming language model. A fine point, but > different nontheless. Declarative languages are hard to get your head around > if you think in purely imperativ

Re: Basic string replacement

2010-03-05 Thread daniel . klein
Because it is a declarative promise language - which is somewhat different than the usual imperative programming language model. A fine point, but different nontheless. Declarative languages are hard to get your head around if you think in purely imperative terms. Once you "let go" and allow you

Re: Basic string replacement

2010-03-02 Thread Les Mikesell
On 3/2/2010 11:28 AM, Daniel V Klein wrote: > > Cfengine is not a programming language - it may have some language-like > features, but it is not a programming language. How can something that controls what a program does not best be understood as a programming language? -- Les Mikesell

Re: Basic string replacement

2010-03-02 Thread Jesse Becker
On Tue, Mar 02, 2010 at 12:28:25PM -0500, Daniel V Klein wrote: >> That's good to hear--there's at least one other crazy person here! :-) > >That's me, crazy... > >> >As long as you're at it, you probably want a tolower() and toupper() functio >> n. >> >> And, left(), right(), substr(), length(),

Re: Basic string replacement

2010-03-02 Thread Daniel V Klein
> That's good to hear--there's at least one other crazy person here! :-) That's me, crazy... > >As long as you're at it, you probably want a tolower() and toupper() functio > n. > > And, left(), right(), substr(), length(), sprintf(), s///, and others. No. left/right/substr are from before re

Re: Basic string replacement

2010-03-02 Thread Jesse Becker
On Tue, Mar 02, 2010 at 10:58:35AM -0500, Daniel V Klein wrote: >Speaking just for myself (and not cfengine today), I think this is a good idea. That's good to hear--there's at least one other crazy person here! :-) >As long as you're at it, you probably want a tolower() and toupper() function.

Re: Basic string replacement

2010-03-02 Thread Jesse Becker
On Tue, Mar 02, 2010 at 10:45:32AM -0500, Mark Burgess wrote: > >Why don't you use the expand_template method for file editing? I already do. I am working on writing several things "around" this, so that I canget to calling expand_template in a generalized bundle, instead of duplicating many line

Re: Basic string replacement

2010-03-02 Thread Daniel V Klein
Speaking just for myself (and not cfengine today), I think this is a good idea. As long as you're at it, you probably want a tolower() and toupper() function. You can get "ignore case" on regular expression matching with PCRE '(?i)', but converting to lower or to upper on output is harder (and if y

Re: Basic string replacement

2010-03-02 Thread Mark Burgess
Why don't you use the expand_template method for file editing? M Jesse Becker wrote: > On Tue, Mar 02, 2010 at 08:33:15AM -0500, nwat...@symcor.com wrote: >> I don't think there is a function at present for string search a replace >> actions out side of file editing. Perhaps look at it from a

Re: Basic string replacement

2010-03-02 Thread NWatson
canonify will change /path/to/file to path_to_file. Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY WARNING This communication, including any attachments, is for the exclusive use of addressee and may contain proprietary and/or confidential information. If you are not the intended reci

Re: Basic string replacement

2010-03-02 Thread Jesse Becker
On Tue, Mar 02, 2010 at 08:33:15AM -0500, nwat...@symcor.com wrote: >I don't think there is a function at present for string search a replace >actions out side of file editing. Perhaps look at it from a higher level. > Why is string manipulation needed? There are two reasons, one specific, and

Re: Basic string replacement

2010-03-02 Thread NWatson
I don't think there is a function at present for string search a replace actions out side of file editing. Perhaps look at it from a higher level. Why is string manipulation needed? Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY WARNING This communication, including any attachments,

Basic string replacement

2010-03-01 Thread Jesse Becker
I feel like I'm missing something really obvious here: is there a way to do basic string search and replacement? For example, I have a string "foo:bar:baz", and I want to convert ":ba" into "-DA". Thus, the output string would be "foo-DAr-DAz". This is trivial in perl/sed/awk, but I can't find