Given a collection of strings which start all with prefix _abc_ABC(
and end with suffix )
, for instance,
val a = """_abc_ABC(
{
x = 1
y = 2
})"""
how to define a regular expression that strips out the prefix and suffix above ?
Given a collection of strings which start all with prefix _abc_ABC(
and end with suffix )
, for instance,
val a = """_abc_ABC(
{
x = 1
y = 2
})"""
how to define a regular expression that strips out the prefix and suffix above ?
This would work:
val a = """_abc_ABC(
{
x = 1
y = 2
})"""
val Re = """(?s)_abc_ABC\((.*)\)""".r
a match { case Re(content) => println(content) }
The (?s)
makes it match over multiple lines.