-
-
Notifications
You must be signed in to change notification settings - Fork 370
Adding your own Regex
Need help? Visit our discord! http://discord.skerritt.blog
- Visit our regex file here
- 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.
- Write tests!
- Write tests here: https://github.com/bee-san/pyWhat/blob/main/tests/test_regex_identifier.py and here: https://github.com/bee-san/pyWhat/blob/main/tests/test_click.py which uses this file: https://github.com/bee-san/pyWhat/blob/main/fixtures/file
Just copy and paste the other tests, but replace the:
- Name
- Inputted text
It's important we properly test our code :-)