Re:RegExpBuilder – Create regular expressions using chained ...
by _lce0 on Wednesday February 11, 2015 @02:16PM
(#9034970)
hey thanks to share!
TIL
Although Rebol can be used for programming,
writing functions, and performing processes,
its greatest strength is the ability to
easily create domain-specific languages or
dialects.
— Carl Sassenrath [Rebol author]
https://en.wikipedia.org/wiki/Rebol
Re:RegExpBuilder – Create regular expressions using chained ...
by carlob on Wednesday February 11, 2015 @05:31PM
(#9036141)
Mathematica also has its own string pattern sytax
http://reference.wolfram.com/language/ref/StringExpression.h...
Something like that would be
StringExpression[
"$",
Repeated[DigitCharacter],
".",
DigitCharacter,
DigitCharacter
]
or StringExpression[
"$",
Repeated[DigitCharacter],
".",
Repeated[DigitCharacter, {2}],
]
or StringExpression[
"$",
NumberString
]
and the other is StringExpression[
Repeated[
StringExpression[
Repeated["p", {1, Infinity}],
Repeated["q", {2, Infinity}]
],
{2}
]
]
This can be made more concise since StringExpression has an infix form (~~) and Repeated can sometimes be replaced by postfix ..
Re:RegExpBuilder – Create regular expressions using chained ...
by akater on Friday February 13, 2015 @01:00AM
(#9043120)
> Repeated can sometimes be replaced by postfix ..
Always, not sometimes. ;-)
Re:RegExpBuilder – Create regular expressions using chained ...
by raiph on Thursday February 12, 2015 @11:44AM
(#9039680)
Perl 6 unifies "regexes" and recursive descent parsing:
'$10.00' ~~ rx{ \$ \d+ \. \d\d };
my $pat = rx{ \p+ \q**2..Inf }; 'pqqpqq' ~~ rx{ <$pat>**2 }
Note that these "regexes" are syntax, not strings, checked and converted in to a hybrid DFA/NFA at compile-time.
Some parse refs: http://en.wikibooks.org/wiki/REBOL_Programming/Language_Feat... | http://www.rebol.net/wiki/Parse_Project | http://www.rebol.com/r3/docs/concepts/parsing-summary.html