Allow \S for negated whitespace regex shorthand
This commit is contained in:
parent
3edb5dbdd9
commit
902b7f9745
2 changed files with 12 additions and 2 deletions
|
|
@ -30,7 +30,7 @@ describe("parse_regex", []() {
|
|||
|
||||
{
|
||||
"character classes",
|
||||
"\\w-\\d-\\s",
|
||||
"\\w-\\d-\\s-\\S",
|
||||
seq({
|
||||
character({
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
|
||||
|
|
@ -41,7 +41,10 @@ describe("parse_regex", []() {
|
|||
character({ '-' }),
|
||||
character({ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }),
|
||||
character({ '-' }),
|
||||
character({ ' ', '\t', '\r', '\n' }) })
|
||||
character({ ' ', '\t', '\r', '\n' }),
|
||||
character({ '-' }),
|
||||
character({ ' ', '\t', '\r', '\n' }, false)
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,6 +192,13 @@ class PatternParser {
|
|||
case 's':
|
||||
return CharacterSet().include(' ').include('\t').include('\n').include(
|
||||
'\r');
|
||||
case 'S':
|
||||
return CharacterSet()
|
||||
.include_all()
|
||||
.exclude(' ')
|
||||
.exclude('\t')
|
||||
.exclude('\n')
|
||||
.exclude('\r');
|
||||
case 't':
|
||||
return CharacterSet().include('\t');
|
||||
case 'n':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue