473,385 Members | 2,015 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,385 software developers and data experts.

regular expression unicode character class trouble

Hi,

I need in a unicode-environment the character-class

set("\w") - set("[0-9]")

or aplha w/o num. Any ideas how to create that? And what performance
implications do I have to fear? I mean I guess that the characterclasses
aren't implementet as sets, but as comparison-function that compares a
value with certain well-defined ranges.

Regards,

Diez
Sep 4 '05 #1
2 1540
Diez B. Roggisch wrote:
Hi,

I need in a unicode-environment the character-class

set("\w") - set("[0-9]")

or aplha w/o num. Any ideas how to create that?


I'd use something like r"[^_\d\W]", that is, all things that are neither
underscores, digits or non-alphas. In action:

py> re.findall(r'[^_\d\W]+', '42badger100x__xxA1BC')
['badger', 'x', 'xxA', 'BC']

HTH,

STeVe
Sep 4 '05 #2
Steven Bethard wrote:
I'd use something like r"[^_\d\W]", that is, all things that are neither
underscores, digits or non-alphas. In action:

py> re.findall(r'[^_\d\W]+', '42badger100x__xxA1BC')
['badger', 'x', 'xxA', 'BC']

HTH,


Seems so, great!

Diez
Sep 5 '05 #3

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

Similar topics

1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
9
by: Mike P | last post by:
I have a regular expression that I use on text boxes where I want to limit the user to letters a-z and spaces. I now need to allow characters such as , and (Nordic characters). Does anybody...
0
by: Laser Lu | last post by:
Hi, all, Does any body recognize \p{name} in Regular Expression? In MSDN, it says the \p{name} represents a named character class, the original description is as follows: "Matches any character...
6
by: dotnetprogram | last post by:
Does anybody have a regular expression to be used in the validation controls of asp.net that checks if the text inputted is: 1) alphanumeric and doesn't include special characters and symbols...
7
by: Steve | last post by:
Hi I have a regular expression validator for my username field which just allows 3 to 30 characters without spaces to be inputted by the user. ^\S{3,30}$ How can I add to this expression not...
6
by: Ludwig | last post by:
Hi, i'm using the regular expression \b\w to find the beginning of a word, in my C# application. If the word is 'public', for example, it works. However, if the word is '<public', it does not...
15
by: Mark Rae | last post by:
Hi, I'm trying to construct a RegEx pattern which will validate a string so that it can contain: only the numerical characters from 0 to 9 i.e. no decimal points, negative signs, exponentials...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
4
by: శ్రీనివాస | last post by:
Hai friends, Can any one tell me how can i remove a character from a unocode text. కల్‌&హార is a Telugu word in Unicode. Here i want to remove '&' but not replace with a zero width...
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: 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: 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
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
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.