Ignoring an arbitrary prefix in a parser combinator
问题 After getting fed up with regexes I have been trying to use scala's parser combinator libraries as a more intuitive replacement for regexes. However, I've run into a problem when I want to search a string for a pattern and ignore things that come before it, for example if I want to check if a string contains the word "octopus" I can do something like val r = "octopus".r r.findFirstIn("www.octopus.com") Which correctly gives Some(octopus) . However, using parser combinators import scala.util