[Commons Configuration] specify a regular expression as string property

T

T E Schmitz

Hello,

I am using Jakarta Commons Configuration. I have specified the following
as a property:

first.name.pattern=.{0,30}

String pattern = config.getString ("first.name.pattern");

fails because the property is interpreted as ArrayList.

Is there any way to force it to be interpreted as a String?

--


Regards,

Tarlika Elisabeth Schmitz
 
T

T E Schmitz

Here's the solution in case anybody is interested:

The Commons Configuration PropertiesTokenizer lets you escape commas
with a backslash ('\').

As java.util.Properties interprets single backslashes as the beginning
of an escape sequence, the comma has to escaped with a double backslash:

first.name.pattern=.{0\\,30}


Regards,

Tarlika Elisabeth Schmitz
 

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

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top