Regular expression of empty string

S

ST Wong

Hi all,

As metacharaters ^ and $ are not used in regular expression in XML,
I'm looking for how to specify empty string.

Would anyone please help?
Thanks a lot.
Regards,
ST Wong
 
R

Richard Tobin

ST Wong said:
As metacharaters ^ and $ are not used in regular expression in XML,
I'm looking for how to specify empty string.

Assuming you mean XML Schema regular expressions, the empty regular
expression matches only the empty string.

-- Richard
 
S

ST Wong

Assuming you mean XML Schema regular expressions, the empty regular
expression matches only the empty string.

-- Richard

Thanks.

BTW, I've an xml file contains patterns for matching strings. It's
okay to match non-null strings by specifying the regular expression in
this way:

<data>.+</data>

But failed to match null string if I specify something like this:

<data></data>

Would you pls help?
I'm new to XML and sorry for the naive question.

Thanks again.
Sincerely,
ST Wong
 
R

Richard Tobin

ST Wong said:
BTW, I've an xml file contains patterns for matching strings. It's
okay to match non-null strings by specifying the regular expression in
this way:

<data>.+</data>

But failed to match null string if I specify something like this:

<data></data>

Would you pls help?

You haven't told us what program it is that is using these regular
expressions. XML itself doesn't say anything about regular
expressions.

-- Richard
 
S

ST Wong

You haven't told us what program it is that is using these regular
expressions. XML itself doesn't say anything about regular
expressions.

-- Richard

The file is used by Java programs.

Sorry for missing such important information.

Thanks again.
/ST
 
R

Richard Tobin

ST Wong said:
The file is used by Java programs.

I think you need to refer to the Java regular expression
documentation, rather than XML.

-- Richard
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,076
Latest member
OrderKetoBeez

Latest Threads

Top