in reply to Doesn't seem complete
in thread Regular expression double grouping negation headache

No, it would be written foo=moo\ shoo=coo and will be parsed right by my code. The big limitation is that you can't have an = in the key part but I can't see that being much of a problem. And actually an assertion would handle that case.

-pete
"Pain heals. Chicks dig scars. Glory lasts forever."

Replies are listed 'Best First'.
Re: Re: Doesn't seem complete
by tlhf (Scribe) on Jun 30, 2002 at 22:48 UTC
    Er, the limitation of not being able to parse an equals sign was the one I was talking about it.

    Which is cute. Except it fails under some conditions. Let's say you want to give the variable 'foo' the value of 'moo shoo= coo'. I'd assume it would be written 'foo=moo shoo\= coo'. Except your example doesn't allow for this.
    Your code wouldn't parse it correctly, although an assertion would be emminently acceptable.

    tlhf
    xxx
      Once again, you have misunderstood the problem. The string you are passing in will be parsed by the shell as 2 arguments. The first being foo=moo which will properly be parsed as foo => moo. The second being shoo\= coo which will also be properly parsed as shoo\ => coo. In order to embed a space into the tag you need to escape the space, so that the shell will parse it as one argument. Thus making the correct string, foo=moo\ shoo=\ coo
      Try the code I posted on the strings and you will see that it works. the limitation is that it can't parse an equal sign in the key, not in the value as you are trying to do.



      -pete
      "Pain heals. Chicks dig scars. Glory lasts forever."
        "the shell"?

        Well, if you're using a shell which breaks up arguments like that, and that you don't want to run your application under different conditions at any point, then yes, it would work. However, a lot of shells don't. Shells break arguments up in a number of different ways. I usually find the simplist way of making sure my app comparatively portable is to join these elements of ARGV back up. I apologies for not making this clearer at the top of my first post in this thread. And I also apologies for making it clearer that I was pointing out the problems of an equals in the value.

        The example you've given would work under the system you have now like that. But I didn't miss the point, I just explained myself badly.

        tlhf
        xxx