All Projects → mndrix → regex

mndrix / regex

Licence: Unlicense license
Regular expressions for Prolog

Programming Languages

prolog
421 projects

Projects that are alternatives of or similar to regex

Regaxor
A regular expression fuzzer.
Stars: ✭ 35 (+118.75%)
Mutual labels:  regex, regular-expression
RegexReplacer
A flexible tool to make complex replacements with regular expression
Stars: ✭ 38 (+137.5%)
Mutual labels:  regex, regular-expression
Regex Dos
👮 👊 RegEx Denial of Service (ReDos) Scanner
Stars: ✭ 143 (+793.75%)
Mutual labels:  regex, regular-expression
doi-regex
Regular expression for matching DOIs
Stars: ✭ 28 (+75%)
Mutual labels:  regex, regular-expression
pcre-heavy
A Haskell regular expressions library that doesn't suck | now on https://codeberg.org/valpackett/pcre-heavy
Stars: ✭ 52 (+225%)
Mutual labels:  regex, regular-expression
Micromatch
Contributing Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Stars: ✭ 1,979 (+12268.75%)
Mutual labels:  regex, regular-expression
Regex.persian.language
Collection of Regex for validating, filtering, sanitizing and finding Persian strings
Stars: ✭ 172 (+975%)
Mutual labels:  regex, regular-expression
To Regex Range
Pass two numbers, get a regex-compatible source string for matching ranges. Fast compiler, optimized regex, and validated against more than 2.78 million test assertions. Useful for creating regular expressions to validate numbers, ranges, years, etc.
Stars: ✭ 97 (+506.25%)
Mutual labels:  regex, regular-expression
regex-comuns
Um estudo de regex comuns
Stars: ✭ 15 (-6.25%)
Mutual labels:  regex, regular-expression
Regex For Regular Folk
🔍💪 Regular Expressions for Regular Folk — A visual, example-based introduction to RegEx [BETA]
Stars: ✭ 242 (+1412.5%)
Mutual labels:  regex, regular-expression
regex-not
Create a javascript regular expression for matching everything except for the given string.
Stars: ✭ 31 (+93.75%)
Mutual labels:  regex, regular-expression
moar
Deterministic Regular Expressions with Backreferences
Stars: ✭ 19 (+18.75%)
Mutual labels:  regex, regular-expression
Js Regular Expression Awesome
📄我收藏的正则表达式大全,欢迎补充
Stars: ✭ 120 (+650%)
Mutual labels:  regex, regular-expression
compiler-design-lab
These are my programs for compiler design lab work in my sixth semester
Stars: ✭ 47 (+193.75%)
Mutual labels:  regex, regular-expression
Orchestra
One language to be RegExp's Successor. Visually readable and rich, technically safe and extended, naturally scalable, advanced, and optimized
Stars: ✭ 103 (+543.75%)
Mutual labels:  regex, regular-expression
Grex
A command-line tool and library for generating regular expressions from user-provided test cases
Stars: ✭ 4,847 (+30193.75%)
Mutual labels:  regex, regular-expression
Hyperscan Java
Match tens of thousands of regular expressions within milliseconds - Java bindings for Intel's hyperscan 5
Stars: ✭ 66 (+312.5%)
Mutual labels:  regex, regular-expression
Globbing
Introduction to "globbing" or glob matching, a programming concept that allows "filepath expansion" and matching using wildcards.
Stars: ✭ 86 (+437.5%)
Mutual labels:  regex, regular-expression
Regexpu
A source code transpiler that enables the use of ES2015 Unicode regular expressions in ES5.
Stars: ✭ 201 (+1156.25%)
Mutual labels:  regex, regular-expression
FileRenamerDiff
A File Renamer App featuring a difference display before and after the change.
Stars: ✭ 32 (+100%)
Mutual labels:  regex, regular-expression

Synopsis

:- use_module(library(regex)).
?- '99 Bottles of Beer' =~ '[0-9]+ bottles'/i.
true.

Description

Regular expression support for Prolog.

When Prologers want to match a string against a pattern, they typically write a DCG. DCGs are powerful and flexible. For medium to large patterns, they are also easier to read and maintain. However, for small and local patterns the overhead of writing and naming auxiliary predicates can be too much. In those circumstances, one might prefer a regular expression. This pack makes it possible.

The =~ operator matches a string (on the left side) against a regular expression (on the right side). Either side can be an atom or a list of codes. The \~ operator succeeds if the string does not match the pattern.

Syntax Reference

This section lists the regular expression syntax accepted by library(regex). Syntax not listed here is not yet supported. Patches welcome.

Single characters

  • . - any character, including newline
  • [xyz] - character class
  • [^xyz] - negated character class
  • \d - Perl character class
  • \D - negated Perl character class

Composites

  • xy - x followed by y
  • x|y - x or y (prefer x)

Repetitions

  • x* - zero or more x, prefer more
  • x+ - one or more x, prefer more
  • x? - zero or one x, prefer one
  • x{n,m} - n or n+1 or ... or m x, prefer more
  • x{n,} - n or more x, prefer more
  • x{n} - exactly n x

Grouping

  • (re) - numbered capturing group
  • (?<name>re) - named & numbered capturing group

Flags

  • i - case-insensitive (default false)
  • s - let . match \n (default false)

Empty strings

  • ^ - at start of text
  • $ - at end of text

Character class elements

  • x - single character
  • A-Z - character range (inclusive)

Perl character classes

  • \d - digits (same as [0-9])
  • \D - not digits (same as [^0-9])
  • \s - whitespace (same as [\t\n\f\r ])
  • \S - not whitespace (same as [^\t\n\f\r ])
  • \w - word characters (same as [0-9A-Za-z_])
  • \W - not word characters (same as [^0-9A-Za-z_])

Acknowledgements

Rob Cameron for his lecture notes on which the original implementation was based.

Installation

Using SWI-Prolog 6.3 or later:

?- pack_install(regex).

This module uses semantic versioning.

Source code available and pull requests accepted at http://github.com/mndrix/regex

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].