473,387 Members | 1,619 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,387 software developers and data experts.

restrict simpleType to word characters and spaces except digits

Hi,

I'm having an hard time to build a regular expression that:
- Will accept words;
- Will accept spaces;
- But cannot accept digits;

Examples:

This is a game
Olá Mundo
Módulo A

An initial approach was:

<xs:simpleType name="nomeType">
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
<xs:pattern value="[\w\s]+" />
</xs:restriction>
</xs:simpleType>

But this will accept values like this:

Módulo 1234

I could use "[\w\s]+" [a-zA-Z\s] but i've to accept other letters from
ISO-8859-15 like á or Í.

The attempt:
<xs:simpleType name="nomeType">
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
<xs:pattern value="[\w\s]+" />
<xs:pattern value="\D+" />
</xs:restriction>
</xs:simpleType>

does not work either.

Thanks in advance,

Anil Mamede
Apr 4 '08 #1
3 2618
Anil Mamede wrote:
<xs:simpleType name="nomeType">
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
<xs:pattern value="[\w\s]+" />
</xs:restriction>
</xs:simpleType>
The specification <URL:defines
\w
as
"[#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] (all characters except the set
of "punctuation", "separator" and "other" characters)"
so that includes digits.

If you use
<xs:pattern value="\P{N}+"/>
then you allow anything that is not a "Number" character.

Or you need to list the characters you want to allow.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 4 '08 #2
On 4 Abr, 18:35, Martin Honnen <mahotr...@yahoo.dewrote:
Anil Mamede wrote:
<xs:simpleType name="nomeType">
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
<xs:pattern value="[\w\s]+" />
</xs:restriction>
</xs:simpleType>

The specification <URL:defines
\w
as
"[#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] (all characters except the set
of "punctuation", "separator" and "other" characters)"
so that includes digits.

If you use
<xs:pattern value="\P{N}+"/>
then you allow anything that is not a "Number" character.

Or you need to list the characters you want to allow.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Martin Honnen thanks a lot. I'll try that.
Apr 6 '08 #3
Anil Mamede (an*********@gmail.com) wrote:
: Hi,

: I'm having an hard time to build a regular expression that:
: - Will accept words;
: - Will accept spaces;
: - But cannot accept digits;
What is a word?

I guess that any alphanumeric is a word.
Therefore a number is a word.

So you need a word that has at least one character.

In perl speak (untested))

/(\w*[a-zA-Z]\w*)|(\s+)/

$0.10

Apr 7 '08 #4

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

Similar topics

1
by: Eric A. Johnson | last post by:
Hi, Thanks for reading this. How do I list all possible permutations of a word? I've figured out how to get all the characters in alphabetical order. I then want to display every possible...
1
by: Don Adams | last post by:
I would like to have the following XML: <phone type="work">555-123-1234</phone> <phone type="home">555-123-4321</phone> Is it possible to write a schema to restrict the contents of the type...
3
by: gdogg1587 | last post by:
Greetings. I'm working on a program that will "descramble" words. Think of a word scramble game where there is a list of characters, and several blank spaces to denote the word(s) that you are...
2
by: Ian Griffiths | last post by:
I have been given a schema, instances of which I'm required to be able to consume and generate. I'd like to be able to manipulate these instances as DataSets internally in my application. The...
1
by: Maksim | last post by:
Trying to find out a way how to restrict value of the element by name of an element, it might be not even possible, but anyhow. Let's consider following snippet: <xs:element name="tag1"...
0
by: Codex Twin | last post by:
hello group: The following is a fragment from a schema which defines the EWethnicCategoryStructure type. As you can see, its type is defined by the SimpleType enumeration EWethnicCategoryType....
2
by: bogus1one | last post by:
To all you XML experts, let's say I have the following in an XML doc: <heading units="TRUE">55</heading> I would like to develop a schema that will both provide for an enumeration for the...
5
by: Dakrat | last post by:
Allow me to preface this post by saying that this is my first database project, and while I have learned a lot, any concepts I have learned are hit and miss as I have found new requirements and...
9
by: George | last post by:
C with 2 sprained hands. I would nlike to emulate the t4 encoding scheme using the following graphic: * * * * * * ***** o O o o
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.