Click here to Skip to main content
15,887,434 members
Home / Discussions / C#
   

C#

 
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 
GeneralZip files and send to sever Pin
minniemooo12-Mar-08 23:48
minniemooo12-Mar-08 23:48 
GeneralRe: Zip files and send to sever Pin
Christian Graus12-Mar-08 23:58
protectorChristian Graus12-Mar-08 23:58 
Generalcompare today's date and last created file than if more than 7 days delete it Pin
blue112-Mar-08 23:44
blue112-Mar-08 23:44 
GeneralRe: compare today's date and last created file than if more than 7 days delete it Pin
Christian Graus13-Mar-08 0:00
protectorChristian Graus13-Mar-08 0:00 
GeneralRe: compare today's date and last created file than if more than 7 days delete it Pin
blue113-Mar-08 0:06
blue113-Mar-08 0:06 
GeneralRe: compare today's date and last created file than if more than 7 days delete it Pin
phannon8613-Mar-08 0:26
professionalphannon8613-Mar-08 0:26 
GeneralRe: compare today's date and last created file than if more than 7 days delete it Pin
Christian Graus13-Mar-08 0:28
protectorChristian Graus13-Mar-08 0:28 
Generalcompare today's date and last created file than if more than 7 days delete it Pin
blue112-Mar-08 23:43
blue112-Mar-08 23:43 
GeneralDebug and Release Mode Pin
half-life12-Mar-08 22:54
half-life12-Mar-08 22:54 
GeneralRe: Debug and Release Mode Pin
Bekjong12-Mar-08 23:36
Bekjong12-Mar-08 23:36 
GeneralRe: Debug and Release Mode Pin
half-life13-Mar-08 6:32
half-life13-Mar-08 6:32 
GeneralRe: Debug and Release Mode Pin
Colin Angus Mackay12-Mar-08 23:37
Colin Angus Mackay12-Mar-08 23:37 
GeneralRe: Debug and Release Mode Pin
half-life13-Mar-08 6:33
half-life13-Mar-08 6:33 
GeneralRe: Debug and Release Mode Pin
DJ van Wyk13-Mar-08 2:36
professionalDJ van Wyk13-Mar-08 2:36 

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.