[DGD] get_dir() oddity

Erwin Harte harte at is-here.com
Thu Dec 20 21:11:28 CET 2007


bart at wotf.org wrote:
> On Thu, 20 Dec 2007 11:09:52 -0800, Shentino wrote
>> If you can escape the [] with \'s it probably isn't so bad.  If not, 
>> then... ___________________________________________ 
> 
> You can't, but you can use [[] to match a single [

Sure you can.  Read The F* Manual :)

       ?       any single character
       *       any (possibly empty) string
       [a-z]   any character in the range a-z
       [^a-z]  any character not in range a-z
=>    \c      the character c, not interpreted as having a special
               meaning

The gotcha is that to insert an actual \ into a string in LPC you need 
to double it, so this won't do you any good:

     get_dir("/cmd/comm/\[@.c")

What you need, is:

     get_dir("/cmd/comm/\\[@.c")

Hope that helps,

Erwin.



More information about the DGD mailing list