janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
122 stars 35 forks source link

Tweak repetition comment #12

Closed sogaiu closed 3 years ago

sogaiu commented 3 years ago

I found the comment about repetitions in regex.janet to be confusing: https://github.com/janet-lang/spork/blob/6f8b5a8431dba7fa2df54e6be9eea42d9a4e97d6/spork/regex.janet#L13

I took the curly braces and number to refer to abc in abc{1}, but that does not seem to be correct:

repl:2:> (regex/match "ab{2}" "abab")
nil
repl:3:> (regex/match "(ab){2}" "abab")
@["ab" "ab"]

This PR is just a tweak so that instead of abc{1} or abc{1,3}, a{1} and a{1,3} are used instead.