1
StringCount["one letters three letters letters one letters letters three letters",
"one" ~~ __ ~~ "three"]

gives

1

because there is the one occurence of "one [letters three letters letters one letters letters] three [letters]"

It took me some time to understand that Mathematica "thinks" in this way because I expected the value

2

due to "one letters three letters letters one letters letters three letters"

Now I am facing the problem of finding the code that solves this problem in my desired way.

Gab
  • 433
  • 3
  • 10

0 Answers0