Move toRegex extension in kotlin package

This commit is contained in:
Ilya Gorbunov
2015-09-22 20:52:56 +03:00
parent 9ba50bcdff
commit bf8df0f764
2 changed files with 10 additions and 0 deletions
@@ -16,3 +16,11 @@ public fun String.toRegex(option: RegexOption): Regex = Regex(this, option)
* Converts the string into a regular expression [Regex] with the specified set of [options].
*/
public fun String.toRegex(options: Set<RegexOption>): Regex = Regex(this, options)
/**
* Converts this [Pattern] to an instance of [Regex].
*
* Provides the way to use Regex API on the instances of [Pattern].
*/
@JvmVersion
public fun java.util.regex.Pattern.toRegex(): Regex = Regex(this)
@@ -211,6 +211,8 @@ public class Regex internal constructor(private val nativePattern: Pattern) {
*
* Provides the way to use Regex API on the instances of [Pattern].
*/
@Deprecated("Use extension toRegex instead in kotlin package.")
@HiddenDeclaration
public fun Pattern.toRegex(): Regex = Regex(this)