Skip to content

Commit

Permalink
Changed newline to support all platforms with \R
Browse files Browse the repository at this point in the history
Get RegEx highlight with @language("RegExp") when using regexText.
  • Loading branch information
Cyberavater committed Feb 26, 2024
1 parent 8d6ff76 commit 9cac35b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/kotlin/RegexBuilder.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.co.mainwave.regextoolboxkotlin

import org.intellij.lang.annotations.Language
import java.util.regex.Pattern

/**
Expand Down Expand Up @@ -56,7 +57,7 @@ class RegexBuilder internal constructor() {
* @param quantifier Quantifier to apply to the whole string
* @return The current [RegexBuilder] object, for method chaining
*/
fun regexText(text: String, quantifier: RegexQuantifier? = null): RegexBuilder =
fun regexText(@Language("RegExp") text: String, quantifier: RegexQuantifier? = null): RegexBuilder =
if (quantifier == null) {
addPart(text)
} else {
Expand Down Expand Up @@ -123,7 +124,7 @@ class RegexBuilder internal constructor() {
* @return The current [RegexBuilder] object, for method chaining
*/
fun lineFeed(quantifier: RegexQuantifier? = null) =
addPart("\\n", quantifier)
addPart("""\R""", quantifier)

/**
* Add an element to match a single carriage return character.
Expand Down

0 comments on commit 9cac35b

Please sign in to comment.