473,465 Members | 3,216 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Regex length

Hi.

we have a feature where the user can create a regular expression to do
a mask edit (pattern) on a specific field. This field cannot have more
than 5 characters.

We want to validate the user regular expression so it cannot have more
than 5 characters (restrictions on the database). Is it possible with
the Regex class?

For example the user puts this

P\d{4}

Will give P0001 in the mask edit.

But if he puts this:

P\d{144}

It will give a bigger value. Note that the user can create any regular
expression. We want just a code that, evaluating the expression, gives
us the length of the resulting mask.

Thanks
Nov 15 '07 #1
1 2003
Please try .{0,5}

http://www.alvas.net - Audio tools for C# and VB.Net developers
"Cyber" <cy**********@yahoo.com???????/???????? ? ???????? ?????????:
news:b3**********************************@e4g2000h sg.googlegroups.com...
Hi.

we have a feature where the user can create a regular expression to do
a mask edit (pattern) on a specific field. This field cannot have more
than 5 characters.

We want to validate the user regular expression so it cannot have more
than 5 characters (restrictions on the database). Is it possible with
the Regex class?

For example the user puts this

P\d{4}

Will give P0001 in the mask edit.

But if he puts this:

P\d{144}

It will give a bigger value. Note that the user can create any regular
expression. We want just a code that, evaluating the expression, gives
us the length of the resulting mask.

Thanks

Nov 16 '07 #2

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

Similar topics

4
by: Emilia | last post by:
Hi, I have the following: Dim mystring As String = "1.2 3 456 7........." That is 14818 long Dim theReg As New Regex("( \d|-|\.|\s\d|\s-)+") Dim theMatch As Match = theReg.Match(mystring) If...
7
by: alphatan | last post by:
Is there relative source or document for this purpose? I've searched the index of "Mastering Regular Expression", but cannot get the useful information for C. Thanks in advanced. -- Learning...
7
by: bill tie | last post by:
I'd appreciate it if you could advise. 1. How do I replace "\" (backslash) with anything? 2. Suppose I want to replace (a) every occurrence of characters "a", "b", "c", "d" with "x", (b)...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
17
by: steve | last post by:
here's the deal...cvs, tick encapsulted data. trying to use regex's to validate records. here's an example row: 'AD,'BF','132465','06/09/2004','','BNSF','A','TYPE','1278','','BR','2999',''...
6
by: Frank | last post by:
Hi, I'm beginning to understand regex (regular expressions), but I think there's a better way to do the next thing. I use 2 steps, is it possible to do it in 1 step? <img somestuff ...
10
by: igor.kulkin | last post by:
I have a small utility program written in Python which works pretty slow so I've decided to implement it in C. I did some benchmarking of Python's code performance. One of the parts of the program...
15
by: morleyc | last post by:
Hi, i would like to remove a number of characters from my string (\t \r \n which are throughout the string), i know regex can do this but i have no idea how. Any pointers much appreciated. Chris
4
by: Flomo Togba Kwele | last post by:
I am having difficulty writing a Regex constructor. A line has a quote(") at its beginning and its end. I need to strip both characters off. If the line looks like "1", I need the result to be 1....
1
by: jonnyboy6969 | last post by:
Hi All Really hoping someone can help me out here with my deficient regex skills :) I have a function which takes a string of HTML and replaces a term (word or phrase) with a link. The pupose...
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.