help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regular expressions and backslashes...


From: Adrian Phillips
Subject: Re: Regular expressions and backslashes...
Date: 02 Aug 2001 13:12:41 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

>>>>> "Juri" == Juri Jensen <juri@xenux.dk> writes:

    Juri> Hi, I've been trying to make a configuration file that edits
    Juri> smb.conf (samba conf file) to my liking.

    Juri> However that file contains some path names, windows path
    Juri> names with backslashes. And I'm trying to escape these
    Juri> backslashes as I'm using regular expressions.  Like this:

    Juri> BeginGroupIfNoLineMatching
    Juri> 
"^[[:blank:]]*;*[[:blank:]]*logon[[:blank:]]path[[:blank:]]=[[:blank:]][\][\]%N[\]USERPROFILES[\]%U([[:blank:]]+(;.*)?)?$"
    Juri> ReplaceLineWith ' logon path = \\%N\USERPROFILES\%U ; Edited
    Juri> by cfengine' EndGroup

Hmm, I can't see anything obvious but my brain is running down at the
moment, but a couple of comments :-

- do you think [[:blank:]] makes it easier to read :-)
- there could be several spaces around the =
- have you a copy of the line which this should match
- when I have regexp in perl that don't match I try removing elements
  from the end of the expression til it begins to match then add bits
  back til I find the bit that doesn't work

Sincerely,

Adrian Phillips

-- 
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now?  [OK]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]