Post History
Perl, 113 bytes reads line from stdin formatted as the test cases. Exits with 1 valid or 0 if invalid. perl -lF,. -E'($_,$n)=@F;@r=map{$n=~s/.{$_}\K/.*/r}1..length$n-1;$"="|";exit(!/$n/&&...
#1: Initial revision
# Perl, 113 bytes
reads line from stdin formatted as the test cases. Exits with 1 valid or 0 if invalid.
```sh
perl -lF,. -E'($_,$n)=@F;@r=map{$n=~s/.{$_}\K/.*/r}1..length$n-1;$"="|";exit(!/$n/&&((y/ //d,/.$n./)||/^(@r)$/))'
```
```sh
perl -lF,. -E'
# load clue and word
($_,$n) = @F;
# create all permutations of prefix + ".*" + suffix of word
@r = map {
$n =~ s/.{$_}\K/.*/r
} 1..length$n-1;
# set array->string interpolation character for use in regex
$"="|";
exit(
!/$n/ && ( # word not in clue, and (
(y/ //d,/.$n./) || # is word break, or
/^(@r)$/ # is bookend )
)
)
'
```
[Try it online!][TIO-mnt9shfw]
[TIO-mnt9shfw]: https://tio.run/##ZU5NT4NAEL3vrxibtYBu2fbgiWCKLbWkwJLdJU3jB9GI2qRuCdCkpq0/XVzw4MHLzLw3896bIi83V82uyqHaPVdg5Pt1bThIA2hHE1twgKJcqxpwdjd8uBzCCXX4FYzzCgbXYBCcOY2JM4KV5Y5nzrh0P56KA1buV0XtA85O9wtqX9DyNLLtTa7e6nesBiMH99zesed0OWcUK9rvm@YnBUpfCLWxsql1PNJHc1xamFpW0ySMcZizVPgE@JwhEcS3oQ@Se5MFARFMFmjFUohSIWHKJGjAIRDgxVOYcCbELyMFgVXKpUBCdqvQ97jWS48jySDS7pJFPgpi8CDRrqFmYi9BQZRwlvgcug/0oPu/J1okURJ6sSa12JcENNG6S@23/ItaMrgJ@FTAMpBzYPpeSF3b9NhH39uiXm9V1Qw2M2L/AA "Perl 5 – Try It Online"
