Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
VB.Net PDF 4.4.7
SuiteCRM Survey Rocket Plugin 1.0
Airbnb Clone Script | Airbnb Clone 4.3.1
IP2Location Geolocation Database 2018
ODBC Driver for Salesforce 1.5
Rapid PHP 2018 15.0
Bytescout BarCode Generator SDK 4.70.0.981
Data Puppy Lite (32-bit) 1.0
ProZ clone script 1.0.3
VideoCap Live Streaming SDK ActiveX 8.5
Magento Web to Print 1.0
dbForge Data Compare for MySQL 5.4
dbForge Query Builder for MySQL 4.3
ODBC Driver for NetSuite 1.2
Rapid CSS 2018 15.0
Top Code
OpenCV Delphi wrapper 1.0
Fuzzy k means 1.0
ABBYY FineReader Engine 9.0
Online Food Ordeing System 1.0
Advance Auto Index-DjAmolWap 10.4
Djamolwap 13
GnuWin64 64
Advanced Forced Matrix Script 1.0
BMI Calculator Widget 1.3
2D/3D CAD Import VCL - AutoCAD DXF DWG / HPGL HPGL2 PLT 5
The Spherical K-means algorithm 1.0
Crazy Teris 1.90
Bad Behavior 2.0.42
Jellybean Factory 1.0
C Code Completer 1.0
Top Rated
Output Messenger 1.8.0
Aliexpress Clone- Ec21 Script 1
Indiegogo Clone 3.0
Online Food Ordeing System 1.0
PHP Image Resize Script 1.0
Best Spotify Clone 1.0
Get Random Record Based on Weight 1.0.0
Travel Portal Script 9.29
Magento Product Designer 1.0
OFOS - Just Eat Clone Script 1.0
PrestaShop Upload Images Module 1.2.1
Trading Software 1.2.4
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Simple regex engine, elementary Python 
File ID: 64721






Simple regex engine, elementary Python 
Download Simple regex engine, elementary Python http://code.activestate.com/recipes/577251-simple-regex-engine-elementary-python/?in=lang-pythonReport Error Link
License: Freeware
Downloads: 8
User Rating:3 Stars  (1 rating)
Submit Rating:
Simple regex engine, elementary Python  Description
Description: A short engine for testing against a regex, understanding the 3 common quantifiers
?,+,* (non-greedy) working on characters, ., [...], [^...], s, S, bracketed patterns and group designators N. Accepts unicode objects and fixed-width encoded strings
(but problems with eventual comparisons of trailing bytes in multi-byte utf-letters).
Captures up to 10 groups ( (?:...) implemented), which can be used for back referencing and in xreplace(). Captured groups are accessible after the search in the global list xGroups. | is supported, but only in groups and needing nested=True. nested=False is making '(' and ')' common letters.

This is not about Python or for Python, there it has little use beside re. But regarding that re needs about 6,000 lines you might agree with the author, that these 176 lines are powerful. This was the reason to publish it as a recipe - as a kind of (fairly complete) minimal example of a regex tester and as an example for corresponding recursive structures in data (TokenListCache) and code.

Working on this improved the author's understanding of regular expressions - especially of their eventual "greed". "Greedy" quantifiers are a concept, which has to be explained seperately and is coming unexpected: Whoever is scanning a text for '<.*>', s/he will search SGML tags, not the whole text. Even with the star's "greediness" the code has to take care, that '.*' doesn't eat the whole text finding no match for '<.*>' at all. Thus the standard syntax with greedy quantifiers cannot be simpler to implement than this with its mere 3 lines 101, 111 and 121 preventing any greed. Perhaps it is faster - otherwise it is difficult to understand, why the concept "greed" is existing at all.

This engine might be useful here and then under circumstances with nothing else available. Its brevity eases translation to other languages and it can work with arbitrary characters for STAR or PERHAPS (for example).

License: Freeware

Related: cached, Parse, Parsing, recursion, regular expressions

O/S:Windows

Downloads: 8



More Similar Code

PSPE (Pascal's Simple PHP Engine), is a web site (building tool) written in PHP, with a little DHTML (and JavaScript) features, the content is in XML format. An easy to install procedures roundsup the feature list.



Soe stands for Simple OpenGL Engine.This projects aims at giving a simple framework when dealing with 3D.



Simple yet powerful templating engine for Python. Emphasis has been placed on ease of use. Simply put this file into your project directory and do "import template".



htmltmpl is a templating engine for Python and PHP.

It is targeted to web application developers, who want to separate program code and design (HTML code) of their projects. Even webdesigners can easily learn its simple but powerful...



htmltmpl is a templating engine for Python and PHP.

It is targeted to web application developers, who want to separate program code and design (HTML code) of their projects. Even webdesigners can easily learn its simple but powerful...



This is a simple template engine which allows you to replace macros within text. This engine allows for attributes and filters. The default implementation provides the entire string module as filters. Trying to use arguments will of course not...



Ikko is a very simple templating engine.



A search engine to Python Library Reference which can be downloaded for off-line use



this is a simple calculator maked whith python and gtk.



RedBLoG is a simple blog engine for who want a personal blog with support for categories, a little image gallery and download management system. RedBLoG is totally written in php and is released under GPL license.

User Review for Simple regex engine, elementary Python
- required fields
     

Please enter text on the image