Click here to Skip to main content
15,905,914 members
Home / Discussions / C#
   

C#

 
GeneralRe: Display gif image in picture box Pin
leppie13-Mar-08 4:12
leppie13-Mar-08 4:12 
GeneralRe: Display gif image in picture box Pin
asma_panjabi16-Mar-08 19:53
asma_panjabi16-Mar-08 19:53 
GeneralRe: Display gif image in picture box Pin
MuhammadFaisal13-Mar-08 4:56
MuhammadFaisal13-Mar-08 4:56 
GeneralRe: Display gif image in picture box Pin
asma_panjabi13-Mar-08 21:24
asma_panjabi13-Mar-08 21:24 
Generalinsertion data problem Pin
Miss Maheshwari13-Mar-08 2:53
Miss Maheshwari13-Mar-08 2:53 
GeneralRe: insertion data problem Pin
Thomas Krojer13-Mar-08 3:33
Thomas Krojer13-Mar-08 3:33 
GeneralUndefined String Array.. Pin
ptr2void13-Mar-08 2:26
ptr2void13-Mar-08 2:26 
GeneralRe: Undefined String Array.. Pin
AhsanS13-Mar-08 2:48
AhsanS13-Mar-08 2:48 
GeneralRe: Undefined String Array.. Pin
DavidNohejl13-Mar-08 2:49
DavidNohejl13-Mar-08 2:49 
GeneralRe: Undefined String Array.. Pin
DavidNohejl13-Mar-08 2:52
DavidNohejl13-Mar-08 2:52 
GeneralRe: Undefined String Array.. Pin
Martin#13-Mar-08 3:02
Martin#13-Mar-08 3:02 
GeneralRe: Undefined String Array.. Pin
AhsanS13-Mar-08 2:55
AhsanS13-Mar-08 2:55 
GeneralRe: Undefined String Array.. Pin
MuhammadFaisal13-Mar-08 5:07
MuhammadFaisal13-Mar-08 5:07 
QuestionOdbcCommandBuilder for MySQL Pin
adi.rusu13-Mar-08 1:01
adi.rusu13-Mar-08 1:01 
GeneralRe: OdbcCommandBuilder for MySQL Pin
AhsanS13-Mar-08 1:24
AhsanS13-Mar-08 1:24 
GeneralRe: OdbcCommandBuilder for MySQL Pin
adi.rusu13-Mar-08 1:37
adi.rusu13-Mar-08 1:37 
GeneralRe: OdbcCommandBuilder for MySQL Pin
AhsanS13-Mar-08 1:51
AhsanS13-Mar-08 1:51 
GeneralRe: OdbcCommandBuilder for MySQL Pin
adi.rusu13-Mar-08 2:30
adi.rusu13-Mar-08 2:30 
GeneralRe: OdbcCommandBuilder for MySQL Pin
AhsanS13-Mar-08 2:43
AhsanS13-Mar-08 2:43 
GeneralRe: OdbcCommandBuilder for MySQL Pin
adi.rusu13-Mar-08 3:13
adi.rusu13-Mar-08 3:13 
GeneralCurrencymanager Pin
topcatalpha13-Mar-08 1:00
topcatalpha13-Mar-08 1:00 
QuestionGenerate Example from Regex? Pin
BhaaL-san13-Mar-08 0:19
BhaaL-san13-Mar-08 0:19 
Evenin!

I was wondering if it was possible to extract data from a Regex object, such as length boundaries, or possibly generate an example string that will match.

Lets look at some fictual example:
var reg = new Regex("[a-z0-9]{5}"); //mostly simple ones, no forward-lookups, back-references and obscure PCRE stuff<br />
<br />
var helper = new SomeRegexHelperClass(reg);<br />
var str = helper.GenerateExample(); //returns a string like "aaaaa", random is enough<br />
var maxLen = helper.GetMaxLength(); //returns 5, as the maximum chars to be matched is 5<br />
var minLen = helper.GetMinLength(); //returns 5 aswell


So the question is:
Is there anything out there already, that will help me do this?
I'd need either the min/max Length, or an example string, because I have the user enter a Regular Expression which will later be used for validation. But some other stuff requires knowledge of the length of allowed input aswell.

Preferably, I would like to avoid implementing a (rather) complete Regular Expression Parser myself if it was possibly in any other way. I am also open to other suggestions on how to get Infos from the Regex that are not mentioned above, but will lead in the right way.

Thanks in advance.
Greetings, BhaaL
AnswerRe: Generate Example from Regex? Pin
leppie13-Mar-08 0:48
leppie13-Mar-08 0:48 
GeneralRe: Generate Example from Regex? Pin
BhaaL-san13-Mar-08 2:00
BhaaL-san13-Mar-08 2:00 
AnswerRe: Generate Example from Regex? Pin
Chetan Patel13-Mar-08 2:27
Chetan Patel13-Mar-08 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.