Skip to content

Light weight Regular Expression library (experimental)

Notifications You must be signed in to change notification settings

hasumikin/regex_light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C/C++ CI

Regex Light

Acknowledgement

The implementation of regex_light started from this great article: https://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html

Features

  • (): You can make parenthesized groups for backward reference, including nested groups and quantifiers (?, *, +).
  • Character class ([]) literal hyphens (e.g., [-a] or [a-]) are now correctly handled.
  • Small and fast
  • Portablity: Similar API to stdlib's regex

$Lang

  • C.ASCII

Types

  • regex_t
  • regmatch_t

Functions

  • regcomp() # the 3rd arg will be ignored
  • regexec()
  • regfree()

Expressions

  • any literal character
  • . ... any single character
  • ^ ... beginning of the input
  • $ ... end of the input
  • * ... zero or more of previous character
  • + ... one or more of previous character
  • ? ... zero or one of previous character
  • [-] ... specified characters, between the two characters
  • () ... group for backward reference in regmatch_t
  • \. \^ \$ \* \+ \? \[ \( ... escape special characters treating them literals

Expressions which don't work

  • (|) ... group OR group
  • \1 \2 ... backreference in pattern

About

Light weight Regular Expression library (experimental)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published