[Include] Rob Pike's regex matcher
#1

Hey, everyone. Here's a implementation of Rob Pike's simple regex algorithm.

The matcher handles:
c matches any literal character c
. matches any single character
^ matches the beginning of the input string
$ matches the end of the input string
* matches zero or more occurrences of the previous character
* It doesn't handle parentheses (its purpose is to be simple not a complex regex engine)
- but it's not hard to implement it, we can use a recursive descent parser or a elaborated Shunting-yard algorithm, and send the result to the matcher (next version, maybe )

Код:
sregex_match(regexp[], text[])
Return values:
0 - doesn't match
1 - found a match

Include: sregex.inc

Anyway, have fun.
Reply


Messages In This Thread
Rob Pike's regex matcher - by dxhj - 08.12.2015, 15:17
Re: Rob Pike's regex matcher - by Crayder - 09.12.2015, 19:38
Re: Rob Pike's regex matcher - by Kevln - 09.12.2015, 19:51
Re: Rob Pike's regex matcher - by Crayder - 09.12.2015, 21:03
Re: Rob Pike's regex matcher - by Vince - 09.12.2015, 21:38
Re: Rob Pike's regex matcher - by SickAttack - 09.12.2015, 21:39
Re: Rob Pike's regex matcher - by Crayder - 10.12.2015, 01:14
Re: Rob Pike's regex matcher - by dxhj - 10.12.2015, 02:51
Re: Rob Pike's regex matcher - by SickAttack - 10.12.2015, 04:09
Re: Rob Pike's regex matcher - by dxhj - 10.12.2015, 04:13

Forum Jump:


Users browsing this thread: 1 Guest(s)