Skip to content

Adding your own Regex

Kanstantinas Piatrashka edited this page Jul 1, 2021 · 13 revisions

Need help? Visit our discord! http://discord.skerritt.blog

Adding Regex

  1. Visit our regex file here
  2. Add your Regex. Some notes on what the keys mean:
  • name (string): The name of the regex, I.E. IPv4 Address.

  • Regex (string): the regex itself. The regex should be in ^(your regex)$ format.

plural_name (boolean): if the name has to be plural (latitude & longitude coordinates) please set this to True.

  • Description (string): If the name is confusing, please add a description. "Social Security Number" -- the description would be a Wikipedia link explaining it's an American thing. Please do not include a description if the name is not confusing.

  • URL (string): If there is a way to analyse the text online, put it here. An example is Latitude & Longitude coordinates with a URL linking to Google Maps. So it'd do maps.google.com/place/. This way it takes you directly there. Not all regex have URls.

  • rarity (Float between 0.0 and 1.0): How unlikely is it to be a false-positive? 1 for very unlikely, 0 for very likely. ❗ Please place your regex in the file in the order of rarity from smallest to largest. So rarity of 0 will go at the bottom, rarity of 1 will go at the top.

  • Tags (List of strings): A list of tags for the regex. If we already have a similar regex, please use those tags.

  1. Write tests!

Just copy and paste the other tests, but replace the:

  • Name
  • Inputted text

It's important we properly test our code :-)

Clone this wiki locally