Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Commit c7109d6

Browse files
authored
wrap demo in init
1 parent f677beb commit c7109d6

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

contrib/Example.kt

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,25 @@ import com.github.burnett01.expression.ExpressionBuilder
2626

2727
class Example {
2828

29-
val date: String = "20.05.2017"
30-
val origExpr = Regex("(\\d{2}.\\d{2}.\\d{4})")
29+
init {
30+
31+
val date: String = "20.05.2017"
32+
val origExpr = Regex("(\\d{2}.\\d{2}.\\d{4})")
3133

32-
val myExpr: Expression? = expression({
33-
capture {
34-
digit { exact(2) }
35-
literal('.')
36-
digit { exact(2) }
37-
literal('.')
38-
digit { exact(4) }
39-
}
40-
})
34+
val myExpr: Expression? = expression({
35+
capture {
36+
digit { exact(2) }
37+
literal('.')
38+
digit { exact(2) }
39+
literal('.')
40+
digit { exact(4) }
41+
}
42+
})
4143

42-
println(origExpr.find(date)?.value)
43-
println(myExpr!!.compile().find(date)?.value)
44+
println(origExpr.find(date)?.value)
45+
println(myExpr!!.compile().find(date)?.value)
4446

45-
myExpr.debug()
47+
myExpr.debug()
48+
49+
}
4650
}

0 commit comments

Comments
 (0)