GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - taedmonds/python-regex: Simple RegEx pattern matching algorithm with Python

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
.gitignore
.gitignore
 
 
ReadMe.md
ReadMe.md
 
 
regex.py
regex.py
 
 
test.py
test.py
 
 

Repository files navigation

Simple Regular Expression Algorithm (RegEx)

This is a simple regular expression (RegEx) algorithm developed with python.

It supports:

  • Literals ( abc )
  • Ranges ( [a-z], [A-Z], [0-9], [a-zA-Z0-9] )
  • Alternatives ( a|b )
  • Matching in the middle of a string

Usage

To run a string against the regular expression, create a new object of RegEx with the expression or the pattern as its parameter.

Then by using the match function of the RegEx object pass the string as its parameter and get the result.

    from regex import RegEx

    re = RegEx("[a-z0-9]@[a-z].(com|net|org)")
    
    result = re.match("[email protected]") 
    # output: True

    result = re.match("[email protected]") 
    # output: False

    result = re.match("Hello99@gmailcom") 
    # output: False

There are some test cases in tests.py file. Use the below code to run the test cases.

python tests.py

About

Simple RegEx pattern matching algorithm with Python

Topics

pythonregex-patternstring-pattern-matching

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.