V
V
vldud2021-01-22 13:48:21
Algorithms
vldud, 2021-01-22 13:48:21

How to check if a string is a product SKU?

Good afternoon. Has anyone come across a task like: "Determine that string X is a product SKU?". An article is not an article for a specific given range of goods, but an abstract article in a vacuum. Those. article can be:

  • FX-200-7-D
  • 01002099
  • AB001D
  • TPG_53000_M2
  • etc., the list is endless, see examples on trading platforms like Yandex.Market

The formalization of the task, instead of a ready piece of the code interests. But if there is a code in any language, I will be grateful for it. And yes, I understand that the statement of the problem is more than vague, I myself do not like it.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Ananiev, 2021-01-22
@SaNNy32

It seems to me that this is impossible to do. The article can be any set of letters and numbers. There is no general coding rule.
The only way I see is to have a database of articles and refer to it.

S
Sergey Ilyin, 2021-01-22
@sunsexsurf

I would start with an understanding of what article patterns exist in general (maybe they can be segmented by product type, for example, kettles, electric stoves, macbooks).

V
Vladimir Korotenko, 2021-01-22
@firedragon

Create an index on articles and make a selection on this field. This is one of the fastest methods. Another method is to systematize the suppliers and call an article check for each.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question