question about asp.net and searching functionality

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello ,

I'm Wieland, I'm new to ASP.net and now I'm developing a web application
that "searches for MPN (manufacturing part numbers) and returns a result. For
example:

User inputs this MPN in a textbox: RN73H2BTTD1002B25 , the info for each
part of the number are described in the image below.

But what happens if user inputs another MPN and changes the last "25" for a
"30" for example ? Some people told me about using RegExp functions, but that
seems not to work in this case, please help me Scott, don't know what to do,
I'm stuck.

<img src="http://www.koaspeer.com/catimages/res58_chart2.gif">

Thanks in advance.
 
Hi Wieland,

Regex sounds like your best choice, but we're not going to be able to help
you unless we know what the requirements are for an MPN to be considered
valid, and what an acceptable margin of error would be.

Regex can certainly handle a change in 2 characters since it's used for
pattern matching. What you need to find out is, for example:

Are the last two digits always going to be numbers?
What is the valid range? (e.g., Can there be more than two digits on the
end?)
How much change can be expected in the other components of the MPN?
etc.

You should validate an MPN entered by a user against a Regex and return an
error message to the user for invalid entries. You can design a Regex for
valid input to parse the sections of the MPN and store them into separate
variables, which you can then use as parameters to perform your search on
the database or wherever the data is stored, if that is in fact what you are
doing with the MPN once it has been parsed.

"NET Framework Developer's Guide
..NET Framework Regular Expressions"
http://msdn2.microsoft.com/en-us/library/hs600312.aspx
 
Back
Top