44 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda df16fa3306 [K/N] Regex matching zero length should split surrogate pairs #KT-57401
Merge-request: KT-MR-11110
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-26 14:19:25 +00:00
Abduqodiri Qurbonzoda 2248f4ea33 Remove supportsNamedCapturingGroup flag in tests
Now it is true on all platforms
2023-04-26 10:44:21 +00:00
Abduqodiri Qurbonzoda 175566fe56 KT-51908 Common MatchGroupCollection.get(name) extension function 2023-04-26 10:44:21 +00:00
Abduqodiri Qurbonzoda 33fb49f20d Fix JDK7 failing tests 2022-04-06 07:42:58 +00:00
Abduqodiri Qurbonzoda 1cb5cab28f [K/N and WASM] Fix ESCAPE and COMMENTS modes 2022-04-05 15:21:31 +00:00
Abduqodiri Qurbonzoda 9593069cb3 [K/N and WASM] Throw on duplicate group name 2022-04-05 15:21:30 +00:00
Abduqodiri Qurbonzoda 187faa121e Test backreference to group with index zero 2022-04-05 15:21:29 +00:00
Abduqodiri Qurbonzoda 74121b26c0 Test octal literal in regex 2022-04-05 15:21:28 +00:00
Abduqodiri Qurbonzoda 46408ffd9d Fix tests by adjusting to platform behavior 2022-04-05 15:21:27 +00:00
Abduqodiri Qurbonzoda 9c4c1ed557 [K/N and WASM] Implement named capturing group in Regexes #KT-41890 2022-04-05 15:21:26 +00:00
Abduqodiri Qurbonzoda c3f5d03b36 [JS] Support named capture groups in Regex #KT-51775 2022-04-05 15:21:25 +00:00
Ilya Gorbunov a829a6743d KT-50173 Fix Regex.escapeReplacement function in JS 2021-12-12 00:27:31 +00:00
Ilya Gorbunov 4386a800c8 KT-49721 Avoid matching from the same position after a zero-width match
In JS, RegExp can return a match before the specified start index,
if it has matched at that index, but it is in the middle of a surrogate
pair. Account for that when advancing to the next position after
a zero-width match so that it doesn't get to the middle of SP.
2021-11-29 17:02:06 +00:00
Abduqodiri Qurbonzoda dc2f5eab25 Align JS and JVM behavior of Regex replace function #KT-28378 2021-09-30 17:38:03 +00:00
Abduqodiri Qurbonzoda b65c477e68 Regex.splitToSequence, CharSequence.splitToSequence(Regex) #KT-23351 2021-07-20 14:09:24 +00:00
Ilya Gorbunov 455fee29e4 Find correct next match after matchAt and matchEntire KT-47676 2021-07-10 21:31:20 +03:00
Ilya Gorbunov 28a0698463 Regex.matchAt/matchesAt #KT-34021 2021-07-10 21:31:19 +03:00
Abduqodiri Qurbonzoda 1314adb6f7 Locale-agnostic case conversions by default #KT-43023 2020-12-30 10:08:25 +03:00
Abduqodiri Qurbonzoda ddcc3b39f7 JS Regex.find does not throw on invalid start index #KT-36082 2020-02-12 18:26:50 +03:00
Abduqodiri Qurbonzoda c592201a43 Fail fast in Regex.findAll on an invalid startIndex #KT-28356 2020-02-12 18:26:49 +03:00
Ilya Gorbunov 043eddb432 Cleanup: use effects introduced by contracts of assert* functions 2019-12-28 02:51:56 +03:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Alexander Udalov 55c8b35eee Remove unneeded default imports in stdlib and tests 2018-10-01 13:39:02 +02:00
Ilya Gorbunov 5412227380 Unify Regex.split behavior in JVM, JS regarding empty match delimiters
Rewrite split implementation for JVM

#KT-21049
2018-08-30 14:56:31 +03:00
Ilya Gorbunov ecf0d7ec0d Reformat stdlib tests and samples
#KT-5558
2018-04-27 05:28:57 +03:00
Ilya Gorbunov e21c235bbb Add or update copyrights in the standard library sources 2018-04-26 21:57:50 +03:00
Ilya Gorbunov 10639eaf6a Add pattern and options properties to common Regex
And add a test that accesses them and checks they work as expected.
2017-12-26 05:40:37 +03:00
Ilya Gorbunov ecd42f14b3 Compile common stdlib tests against common stdlib
Declare platform-specific test utilities as expect.
2017-12-26 04:55:40 +03:00
Ilya Gorbunov 20b122c1dd Use kotlin.test.Test instead of org.junit.Test in common stdlib tests
(and in jvm-only and js-only tests also)
2017-10-15 17:40:53 +03:00
Ilya Gorbunov 288e0b3c7e Allow to use Regex matches CharSequence and CharSequence matches Regex in infix form
#KT-14279
2017-01-25 21:31:42 +03:00
Ilya Gorbunov 6a70761783 Minor: normalize '@Test' annotation casing in all tests. 2016-11-21 18:20:33 +03:00
Ilya Gorbunov dbcad08a35 Regex: MatchResult.groupValues do not exclude zeroth group, use the same indices as in groups collection.
Provide destructured property for destructured assignment.
2016-01-22 00:59:13 +03:00
Ilya Gorbunov 3459a24b0a Regex: Introduce MatchResult.groupValues to get list of numbered group values exlcuding zeroth group with the entire match. 2016-01-22 00:56:08 +03:00
Ilya Gorbunov 07654eb82b StdLib cleanup, deprecated symbol usage: size() and length() 2015-11-21 00:54:05 +03:00
Ilya Gorbunov 43bb9347c6 Rename Regex.hasMatch to containsMatchIn, and add corresponding contains function to CharSequence. 2015-10-14 22:49:50 +03:00
Ilya Gorbunov d1d865aa0f Rename methods in Regex. Add matchEntire method to match entire string against regex. 2015-10-14 22:49:48 +03:00
Denis Zharkov 5cecaa6f87 Get rid of deprecated annotations and modifiers in stdlib (besides JS) 2015-09-18 10:14:28 +03:00
Ilya Gorbunov 15d69499d0 Stop matching after the end of the input sequence was reached.
#KT-8763 Fixed
2015-08-11 05:11:32 +03:00
Ilya Gorbunov aa6bdb039b Take caution when advancing to the next match after an empty string was matched not to stuck at the same position. 2015-05-09 01:11:30 +03:00
Ilya Gorbunov 260553d516 Temporary workaround due to KT-7502.
Correct usage of joinToString.
Test for passing multiple options.
2015-05-09 01:11:28 +03:00
Ilya Gorbunov 81325208be Remove Regex() and toRegex() overloads with vararg options. Now only zero, one or set of options are allowed. 2015-05-09 01:11:26 +03:00
Ilya Gorbunov db13705506 Tests for match and replace. 2015-05-09 01:11:04 +03:00
Ilya Gorbunov 01ace84070 Regex implementation: split, replace and replaceFirst. 2015-05-09 01:11:00 +03:00
Ilya Gorbunov 559c1604d7 Rename Pattern to Regex.
toRegex now converts string to our regex, and toPattern converts to JVM Pattern.
2015-05-09 01:10:59 +03:00