473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Regular expression of empty string

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
Jul 20 '05 #1
5 7014
In article <28**************************@posting.google.com >,
ST Wong <st*****@alumni.cuhk.net> wrote:
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
Jul 20 '05 #2
ri*****@cogsci.ed.ac.uk (Richard Tobin) wrote in message news:<c5***********@pc-news.cogsci.ed.ac.uk>...
In article <28**************************@posting.google.com >,
ST Wong <st*****@alumni.cuhk.net> wrote:
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


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
Jul 20 '05 #3
In article <28**************************@posting.google.com >,
ST Wong <st*****@alumni.cuhk.net> wrote:
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
Jul 20 '05 #4
ri*****@cogsci.ed.ac.uk (Richard Tobin) wrote in message news:<c5**********@pc-news.cogsci.ed.ac.uk>...
In article <28**************************@posting.google.com >,
ST Wong <st*****@alumni.cuhk.net> wrote:
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


The file is used by Java programs.

Sorry for missing such important information.

Thanks again.
/ST
Jul 20 '05 #5
In article <28**************************@posting.google.com >,
ST Wong <st*****@alumni.cuhk.net> wrote:
The file is used by Java programs.


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

-- Richard
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: AJ | last post by:
Hi All Just a quickie. A form element for a search will contain either a town or a post code. Is there any way we can check the input to see if the element contains a number (in which case it...
3
by: snacktime | last post by:
The primary question is how do I perform a match when the regular expression contains string variables? For example, in the following code I want to match a line that starts with STX, then has any...
9
by: Mark Downes | last post by:
I need to split a string based on a character, such as a space (0x20). The caveat is that I need to ignore the character if it is found between a pair of some other characters, such as...
9
by: Schorschi | last post by:
Not having used regular expressions much, I need some help. Given a string... "This\0Guy\0Needs\0Some\0Help\0\0\0\0\0" Need result as array of strings... "This","Guy", "Needs", "Some", "Help" ...
2
by: Brian Kitt | last post by:
I have a process where I do some minimal reformating on a TAB delimited document to prepare for DTS load. This process has been running fine, but I recently made a change. I have a Full Text...
4
by: Ernesto | last post by:
I'm trying to get the right syntax for my regular expression. The string I'm trying to parse is: # myString Name: David Dude Right now, I'm using the following code:
7
by: Tizzah | last post by:
What is wrong with that? regex = /^(http|https):\/\/+({1}+)*\.{2,5}(({1,5})?\/.*)?$/ if(field.hpage.value != regex.test(field.hpage.value)){ alert("Bad Homepage") field.hpage.focus()...
4
by: gfrith | last post by:
Hi, A quick regex question which I've worked around for the time being, but would like an answer to if anyone can help. I want to match on all strings which end _id, but not those ending...
0
by: altavim | last post by:
Usually when you make regular expression to extract text you are starting from simple expression. When you got to know target text, you are extending your expression. Subsequently very hard to ready...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.