Animesh Sahu
12/22/2020, 10:07 AMval output = (...)
"""public \w*\s*class (.+)\.(\w+) \{\n([^\}]*)\}$""".toRegex().find(output)
Here's the thing to match against:
Compiled from "Test.kt"
public final class com.github.animeshz.keyboard.jni.Test {
public final native void test(kotlinx.coroutines.flow.Flow<java.lang.Integer>);
public com.github.animeshz.keyboard.jni.Test();
}
Seems that regex is correct according to this https://regex101.com/r/PEv4BL/2Vampire
12/22/2020, 10:22 AMval output = """
Compiled from "Test.kt"
public final class com.github.animeshz.keyboard.jni.Test {
public final native void test(kotlinx.coroutines.flow.Flow<java.lang.Integer>);
public com.github.animeshz.keyboard.jni.Test();
}
""".trimIndent()
"""public \w*\s*class (.+)\.(\w+) \{\n([^\}]*)\}$""".toRegex().find(output)
res0: kotlin.text.MatchResult? = kotlin.text.MatcherMatchResult@6c37c36
Do you maybe have a trailing newline character that then does not match due to \}$
not allowing anything after the curly brace?Animesh Sahu
12/22/2020, 10:25 AMAnimesh Sahu
12/22/2020, 10:25 AMAnimesh Sahu
12/22/2020, 10:26 AM*
sorry I wrote + ๐
Animesh Sahu
12/22/2020, 10:27 AMAnimesh Sahu
12/22/2020, 10:28 AMVampire
12/22/2020, 10:30 AMVampire
12/22/2020, 10:31 AMVampire
12/22/2020, 10:31 AM\r\n
Vampire
12/22/2020, 10:32 AM\n
, only using \r
as line terminator (in the meantime switched to \n
)Vampire
12/22/2020, 10:32 AM\r
only using \n
Animesh Sahu
12/22/2020, 10:33 AMVampire
12/22/2020, 10:35 AM\R
in the regex:
Any Unicode linebreak sequence, is equivalent to \u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]
Animesh Sahu
12/22/2020, 10:36 AMVampire
12/22/2020, 10:41 AMVampire
12/22/2020, 10:41 AMVampire
12/22/2020, 10:41 AMnanodeath
12/22/2020, 5:15 PMAnimesh Sahu
12/23/2020, 2:52 AMAnimesh Sahu
12/23/2020, 3:13 AMnanodeath
12/23/2020, 3:35 AM