Skip to content
S41R4J edited this page Aug 12, 2023 · 13 revisions

The usage of simpex is divided into three main methods: Custom Method, Built-in Method and API Method. Each method offers a unique way to generate regex patterns based on your requirements.



Importing & Creating Objects

Before that lets see two ways of importing and creating objects using simpex module:

Large import > Little object

recommended

Importing

from simpex.simpex import simpex

Creating Object

obj = simpex()

Little import < Large object

Importing

import simpex

Creating Object

obj = simpex.simpex()




Methods

Now let's explore these methods to find the approach that best suits your needs:

Custom Method

Custom method is used to generate regex patterns tailored to your dataset. This method is ideal when you have specific data and want to create a regex pattern that perfectly matches your input.

  • sample dataset size:
    • minimum: 3
    • maximum: 100
  • required data type: list
  • return type: str (default) / dict (if, acu = True)
  • function: <obj>.regex()
  • parameters:
    • data_set: dataset (required)
    • num: numbered approach (optional)
      • True: pattern will be created keeping number of characters in mind (eg: phone number)
      • False: default approach (eg: email)
    • acu: accuracy (optional)
      • True: retruns {'regex': <regex pattern>, 'accuracy': <accuracy>}
      • False: default option
from simpex.simpex import simpex  # importing

email = simpex(['test@mail.com', 'admin@email.com', 'example@mail.co'])  # creating simpex obj, with dataset
# With all parameters, obj = simpex(<Dataset>, <True/False>, <True/False>)

pattern = email.regex()  # generating regex pattern

oneliner: pattern = simpex(['test@mail.com', 'admin@email.com', 'example@mail.co']).regex()


Built-in Method

Discover the collection of built-in methods that simpex provides. Choose a built-in pattern that aligns with your needs and generate regex patterns effortlessly.

  • available_patterns:
    • email
    • phone
    • url
    • ipv4
    • ipv6
    • mac
    • credit_card
  • required data type: str
  • return type: str
  • function: <obj>.pattern('<any one of available_patterns>')
  • parameters:
    • data_set: dataset (required)
from simpex.simpex import simpex  # importing

obj = simpex()  # creating simpex obj

pattern = obj.pattern('email')  # generating regex pattern

oneliner: pattern = simpex().pattern('email')


API Method

No api key is required

Discover how simpex seamlessly integrates with external APIs to enhance your regex pattern generation capabilities. Enhance your regex game by harnessing the power of AI-driven regex pattern generation through simpex's API integration. Thank you to websites used in api for providing such wonderful tools.

  • available_apis:
API no. Endpoint Description Input Return Type
1 https://saasbase.dev/tools/regex-generator english to regex (AI) english str str
2 https://www.autoregex.xyz english to regex (AI) english str str
3 https://regex.murfasa.com english to regex (AI) english str str
4 https://regex.ai req. multiple data set large text str list
  • function: <obj>.api(<api's number>)
  • parameters:
    • data_set: dataset (required)
from simpex.simpex import simpex  # importing

email = simpex('email regex pattern')  # creating simpex obj, with data

pattern = email.api(1)  # generating regex pattern

oneliner: pattern = simpex('email regex pattern').api(1)