Skip to main content

0️⃣0️⃣ Remove leading zeroes in Source Format using Regular Expression (RegEx)

In a recent import, a Slate captain noticed that some CEEBs (org keys) were importing with two leading zeroes. Since org keys are generally only 4 digits or 6 digits (but never starting with two leading zeroes), we can use Regular Expression (Regex) to remove the leading zeroes from source file before it is imported into Slate

We will do this by adding the RegEx to the "Format Definition" tab of a Source Format.

image.png

<layout b="," h="1">
  <f id="CEEB" formatterPattern="(?:00(\d{4})|(\d{6}))" formatterReplacement="$1$2" />
</layout>

You may have used RegEx before in queries to remove the +1 from a phone number:
https://knowledge.technolutions.net/docs/query-part-export-settings

RegExone.com is a great tool for learning RegEx.
RegEx101.com is a great tool for testing your RegEx.