Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I know only the how to filter for a fixed length numeric series using RegEx like this \d{4} . But that's not I want because the series to be checked can have a various length.
Could you please give me as many solutions as possible?
Thank you very much!
Posted
Comments
Sergey Alexandrovich Kryukov 16-Oct-11 2:15am    
No, because "as many as possible" would take too much time. Could you suggest less resource-consuming question? :-) Besides, your question looks too simple even for one solution :-). What's the problem, I cannot get it? Why non-fixed length presents additional problem? Perhaps you could give a specific example.
--SA
[no name] 16-Oct-11 2:56am    
You can imagine a customized TextBox with additional filtering feature (right when typing in it). It has a property called RegEx for user to pass in a RegEx to filter for a desired formatted string. That's why the string (series) can be variable in length and RegEx for fixed length is not suitable. My problem is not how to filter but how to filter using REGEX.
Thank you very much!

Medhi is right -
\d*
will work - however, I would suggest
\d+
instead as it requires a minimum of one digit in order to match (\d* will match "A12" as three matches: NULL, "12", NULL - \d+ will only find the "12").

If you are going to use Regexes, then get a copy of Expresso [^] - it's free, and it examines and generates Regular expressions.
 
Share this answer
 
Comments
Mehdi Gholam 16-Oct-11 3:04am    
my 5!
Member 12423349 13-Apr-16 3:34am    
Excuse me rick zeeland said you can help me on a project in C # I am of server client on a single project or must exchange data with a spyder card and a PC the PC and the server and the spyder card and the customer 's all done in C # .Avez you code in C # ?
Mehdi Gholam 13-Apr-16 3:37am    
I don't know rick zeeland.
Member 12423349 13-Apr-16 3:45am    
ok this is probably a surfer who watch any of your code.Je looking for a way to send data between a card and a spyder pc in C # .For this must be a customer serveur.Je do this in Microsoft Visual Studio 2012 .
[no name] 16-Oct-11 3:15am    
Thank you very much! It is really worth a try.
Use the following for getting as many digits as there are :
\d*
 
Share this answer
 
Comments
[no name] 16-Oct-11 3:01am    
Thank you very much! That must be exactly what I want!
I suggest \d+ (at least one digit)

but if you want to capture scientific numbers :
[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?

test it here :
http://www.regular-expressions.info/javascriptexample.html[^]
 
Share this answer
 
Comments
[no name] 16-Oct-11 3:17am    
Thank you very much!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900