|
From: Gordon W. <gwe...@od...> - 2002-08-07 20:04:30
|
Regex is doing a greedy match, that is, the (\w+.*)= matches everything up to the last = in the string. I think that using "-D:(\w+[^=]*)=(\w*.*)" as the regex would cut off the greedy match. The regex puzzles me. It says that a property name can be 1 or more word characters, followed by 0 or more of any character - effectively, any non-word character, since you've already matched all the word characters. I don't remember seeing any definition of what a legal property name is, I suppose that it's any string. That would allow for properties with names like "= ". Sure enough, this build file works:
<project default="test" name="GWSSample">
<property name=" " value="this property has a blank name!"/>
<property name="= " value="this property is named '= '!"/>
<target name="test">
<echo message="${ }"/>
<echo message="${= }"/>
</target>
</project>
-----Original Message-----
In trying to pass a db connection string as a property into NAnt I ran into
a problem:
With an input parameter such as
-D:foobar="blah=true;bleck=false;Provider=SpamSoft"
Then name matches to : "foobar=blah=true;bleck=false;Provider" value to :
"SpamSoft"
NAnt.cs line 64:
Match match = Regex.Match(arg, @"-D:(\w+.*)=(\w*.*)");
Any idea on how to fix this. I am a regexp neophyte.
Kevin Miller
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nant-developers mailing list
Nan...@li...
https://lists.sourceforge.net/lists/listinfo/nant-developers
|