title: Regex in Apache Spark
body: <p>I have a text file that reads like this:-</p>
  
  <p>This recipe can be made either with a stand mixer, or by hand with a bowl, a <br/>wooden spoon, and strong arms. If you use salted butter, please omit the <br/>added salt in this recipe.<br/>
  Yum<br/>
  Ingredients<br/> 
  1 1/4 cups all-purpose flour (160 g)<br/>
  1/4 teaspoon salt<br/>
  1/2 teaspoon baking powder<br/>
  1/2 cup unsalted butter (1 stick, or 8 Tbsp, or 112g) at room temperature<br/>
  1/2 cup white sugar (90 g)<br/>
  1/2 cup dark brown sugar, packed (85 g)<br/>
  1 large egg<br/>
  1 teaspoon vanilla extract<br/>
  1/2 teaspoon instant coffee granules or instant espresso powder<br/>
  1/2 cup chopped macadamia nuts (3 1/2 ounces, or 100 g)<br/>
  1/2 cup white chocolate chips<br/>
  Method<br/>
  1 Preheat the oven to 350°F (175°C). Vigorously whisk together the flour, <br/> and baking powder in a bowl and set aside.<br/></p>
  
  <p>I want to extract the data between words Ingredients and Method. <br/>
  I have written a regex <code>(?s)(?&lt;=\bIngredients\b).*?(?=\bMethod\b)</code><br/>
  to extract the data and it's working fine.<br/>
  But when I try to that using spark-shell like following, it doesn't give me<br/> anything.<br/></p>
  
  <pre><code>val b = sc.textFile("/home/akshat/file.txt")
  val regex = "(?s)(?&lt;=\bIngredients\b).*?(?=\bMethod\b)".r
  regex.findAllIn(b).foreach(println)
  </code></pre>
  
  <p>Please tell me where I am going wrong and what steps should I take to<br/>
  correct this?<br/>
  Thanks in advance!</p>