Dev.to WebDev 🛠 Dev 👁 0 📖 3 min read

Why matching commercial vehicle OEM part numbers in SQL is messy (and how we open-sourced our parser)

When building an automotive or commercial vehicle price comparison engine, the biggest data bottleneck isn't scraping or API rate limits—it's inconsistent OEM and OES part numbers across different supplier feeds. While

Why matching commercial vehicle OEM part numbers in SQL is messy (and how we open-sourced our parser)

When building an automotive or commercial vehicle price comparison engine, the biggest data bottleneck isn't scraping or API rate limits—it's inconsistent OEM and OES part numbers across different supplier feeds.

While building the catalog pipeline for CrazyPartSnatcher (a real-time price comparison platform for commercial vehicle, truck, and trailer spare parts), we constantly ran into the same matching issue across our database tables.

The Problem: 1 Part, 5 Different String Formats

A single truck brake pad, sensor, or filter from manufacturers like MAN, Mercedes-Benz Trucks, DAF, Bosch, Hella, Febi Bilstein, or DT Spare Parts shows up differently in almost every CSV feed and marketplace listing:

  • Supplier A: 81.50110-0144
  • Supplier B: 81 50110 0144
  • Marketplace listing: 81501100144
  • Mercedes OEM format: A 000 420 00 20 vs A0004200020
  • Bosch 10-digit format: 0 986 479 R66

If a workshop mechanic searches for 81.50110.0144 and your SQL query only checks the raw string—or strips characters inconsistently—you miss valid supplier offers.

The Solution: @crazypartsnatcher/oem-normalizer

Instead of keeping this regex and formatting logic locked inside our private backend, we extracted it into a lightweight, zero-dependency TypeScript/JavaScript package and published it on npm and GitHub.

It handles four core tasks out of the box:

  1. normalizeOem(input): Strips formatting noise (dots, dashes, spaces, slashes) into a strict uppercase indexable string for fast SQL/MariaDB lookups.
  2. generateSearchVariants(input): Generates common vendor-specific spacing and punctuation variants for fuzzy search queries.
  3. detectManufacturerFormat(input): Identifies probable OEM/Aftermarket numbering schemas (e.g., Bosch 10-digit, Mercedes A-numbers, MAN formats).
  4. buildPartSearchUrl(oemNumber): Builds direct lookup URLs for live price checks.

Quick Usage Example

Install via npm:

npm install @crazypartsnatcher/oem-normalizer

Use it in your Node.js / TypeScript pipeline or frontend search:

import { 
  normalizeOem, 
  generateSearchVariants, 
  detectManufacturerFormat,
  buildPartSearchUrl 
} from '@crazypartsnatcher/oem-normalizer';

const rawInput = '81.50110-0144';
const cleanKey = normalizeOem(rawInput); // "81501100144"
const variants = generateSearchVariants(rawInput);
const formats = detectManufacturerFormat(rawInput);
const comparisonUrl = buildPartSearchUrl(cleanKey);

Live Interactive Playground & Source Code

We also built a browser-based interactive tester on GitHub Pages where you can paste truck and trailer OEM numbers to test the normalizer and jump straight to live aftermarket price comparisons for brands like Bosch, Hella, Brembo, ATE, Mahle, and Febi Bilstein:

If you are working with TecDoc data, automotive catalogs, or supplier feeds, feel free to fork the repo or open a PR with additional manufacturer regex patterns!

GitHub logo Tom7668h / oem-part-normalizer

Zero-dependency TypeScript/JS library to normalize, parse, and cross-reference commercial vehicle & truck OEM part numbers (MAN, Mercedes-Benz, DAF, Bosch, Hella, Febi). Official core utility powering the CrazyPartSnatcher Nutzfahrzeug & Lkw-Ersatzteile price comparison engine.

@crazypartsnatcher/oem-normalizer

npm version License: MIT TypeScript Ready Zero Dependencies Powered by CrazyPartSnatcher

A lightweight, zero-dependency TypeScript utility library for normalizing, formatting, validating, and generating search variants of automotive and commercial vehicle OEM, OES, and aftermarket part numbers.

This open-source engine serves as the core part number normalizer behind CrazyPartSnatcher – Preisvergleich für Nutzfahrzeug- & Lkw-Ersatzteile, helping workshops, fleet operators, and automotive developers bridge formatting discrepancies across catalogs, ERP inventories, and multi-supplier databases.

The Problem: The Automotive Part Number Chaos

In automotive and commercial vehicle parts data, the identical physical replacement component is represented across ERP systems, TecDoc catalogs, supplier CSV feeds, and workshop management software in dozens of incompatible formats:

  • MAN Truck & Bus: 81.50110.0144 vs. 81501100144 vs. 81.50110-0144 vs. 81 50110 0144
  • Mercedes-Benz / Daimler Truck: A 000 420 00 20 vs. A0004200020 vs. 0004200020 vs. 000 420 00 20
  • Bosch: 0 281 002 461 vs. 0281002461 vs. 0-281-002-461
  • DT Spare Parts: 4.61234 vs. 461234
  • …
📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.