Regex help: processing parameters

  • Thread starter Thread starter Julie
  • Start date Start date
J

Julie

Suppose a string of the following format:

/field=value string /field2=value string2 /field3=value string3

where

field is [a-z], [0-9], and _

value string is any alphanumeric text that doesn't include =, but may include /

What is the regex expression that will split this into field & value?

Thanks
 
I know this doesn't answer your question directly, but you may be able to use
the InstallContext.Parameters property instead of Regex to split the
parameters into name/value pairs.

using System.Configuration.Install;
using System.Collections.Specialized;

class MyClass
{
public static void Main(string[] args)
{
InstallContext context = new InstallContext(null, args);
StringDictionary parameters = context.Parameters;

string value1 = parameters["field1"];
string value2 = parameters["field2"];
string value3 = parameters["field3"];
...
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

REGEX 3
Obfuscate Email 1
regex multiplication problem 3
Rookie thoughts on Regex--useful but not complete 28
Obfuscate 4
Help w/ regex for parsing parameters 2
Regex help 8
RegEx Help!! 2

Back
Top