Python's Regex module--a more powerful regular expression engine (not yet ready to write)

Source: Internet
Author: User
Tags expression engine

Python has its own regular expression engine (built-in re module), but the supported features are thin, and none of the following features are supported:

    • Curing Group Atomic Grouping
    • Occupy priority quantifier possessive quantifiers
    • Variable length reverse-order surround Variable-length Lookbehind
    • Recursive matching Recursive patterns

Matthew Barnett wrote a more powerful regular expression engine-theregex module for Python-that could replace the built-in re module. In addition to some of the features mentioned above, there are many new things.

Let's start with the Regex installation, which you can do at the command line:

Install Regex

The regex is divided into version 0 and version 1 Two working modes, where version 0 is compatible with existing RE modules:

Version 0 (re-module compatible) Version 1
Enable method

Set up. VERSION0 or. V0 flag, or write in an expression (? V0).

If no settings are made, the default is version 0.

Set up. VERSION1 or. V1 flag, or write in an expression (? V1).

Behavior of the. Split () You cannot cut a string at a 0 wide match . You can cut a string at a 0 wide match .
0 wide Match Treated like re. Handled like Perl and PCRE .
The identity inside the expression Only works on the entire expression and cannot be closed. Can be applied to an entire or partial expression and can be closed.
Character groups Only simple character groups are supported. Groups of characters can have nested sets, or can do set operations (set, intersection, difference set, symmetric difference set).
Character case Only simple case is supported by default. The capitalization of all Unicode characters is supported by default.

Python's Regex module--a more powerful regular expression engine (not yet ready to write)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.