Spend Classificaton with RegEx

Intro

Due to wikipedia:
Regular Expression [...] is a sequence of characters that define a search pattern. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation.

Features

App includes following features:

  • Outlook

Demo

Workflow:

  • Having Sap Commodity Codes (comming from the system data extract) embraced within a string:


  • And dictionary with pairs Regex key: Spend Cluster value (written by me):


  • Script can decode the Spend Cluster (defined by me) for upcoming Sap Commodity Codes:


  • We can see 3 codes belog to Office Supplies, 1 to Office Suplies and 1 to Information Technology

Conclusions:

  • I could use Regex to define searching pattern.
  • When a specific Sap Commodity Code matches the pattern, script can map it with appropriate Spend Cluster using my_dict Dictionary.
  • We can treat the script as semi-Machine Learning programm beacause with Regex I teach script to what pattern classify which SAP Commodity Code.

Setup

Python library installation required.

  • pip install regex

Source Code

You can view the source code: HERE