Hello!
A simple task, but I can not figure it out.
Построить регулярные выражения, задающих множество всех таких слов над словарем E = {a, b, c}, в которых за символом b: 1) обязательно следует символ c; 2) не может находиться символ c.
First made: (a|c|bc)+
For the second: (?(?<=b)(a|b)|.)+
But the task is complicated by the fact that it is impossible to use the backward / forward look-up and conditional search, that is, the second task was performed incorrectly.
Thanks a lot in advance!
ps. You can test on:
abc acb bac bca cab cba cabcabcbacbcaaaccbbaaccacbac
Answer: c*(cc|ac*|b|a)*[ab]*
Not sure that the optimal and absolutely correct, but the test examples passed.
b
also a valid option. Likeab
. We need to somehow push separatelyb
, but so thatbc
unacceptable .. - Veikedob
is found, then it should not bec
. That is, for example,abc
should beab
and separatelyc
- Veikedo