Qtr No. 213, New Town Yehlanka Indore 454775
John is trying a pattern in Regular expression to get the output for the given code as "scar". Which code from the given option needs to be placed at Line1 to get the required output?
Note: Assume all necessary imports have been done
object RegExDemo {
def main(args: Array[String]) {
//Line 1
val str = "Scam needs to be avoided so that it does not scare public"
println((pattern findAllIn str).mkString(","))
}
}
val pattern = new Regex("sca[mr]\\d+")
val pattern = new Regex("sca[mr]\\d*")
val pattern = new Regex("scar\\d&")
val pattern = new Regex("Sca[mr]\\d*)
To get all Infosys Certified Scala Programmer Exam questions Join Group https://bit.ly/infy_premium_group
We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.
Qtr No. 213, New Town Yehlanka Indore 454775
admin@prepflix.in