C
Christian Staffe
Hi,
I would like to check for a partial match between an input string and a
regular expression using the Regex class in .NET. By partial match, I mean
that the input string could not yet be complete but I want to know if a
match is possible so far.
For instance I want to design a text box to enter a date and validate the
correctness of the date as the user types character. If the user enters
1953/12/23 it will match my regex of course but I want to check if there is
a potential match after each character is entered by the user. Trying the
match for "1", "19", "195",... 1953/12/2" should tell me that the string
doesn't match but could match ! If I try to validate "1953/16", then I would
get an error because this string will never match the regex even if it's not
yet complete.
Is there a way to do this with .NET regular expressions ?
Christian
I would like to check for a partial match between an input string and a
regular expression using the Regex class in .NET. By partial match, I mean
that the input string could not yet be complete but I want to know if a
match is possible so far.
For instance I want to design a text box to enter a date and validate the
correctness of the date as the user types character. If the user enters
1953/12/23 it will match my regex of course but I want to check if there is
a potential match after each character is entered by the user. Trying the
match for "1", "19", "195",... 1953/12/2" should tell me that the string
doesn't match but could match ! If I try to validate "1953/16", then I would
get an error because this string will never match the regex even if it's not
yet complete.
Is there a way to do this with .NET regular expressions ?
Christian