Skip to content

Bring Dart's RegExp support in line with JavaScript: lookbehinds, property escapes, and named groups. #34935

@gspencergoog

Description

@gspencergoog

So, it appears that JavaScript now does support positive lookbehinds (e.g. "(?<=foo)"), Unicode property escapes (i.e. "\\p{Greek}"), and named capture groups (e.g. "(?<foo>.*)"), at least according to the next release of the ECMA-262 specification. They are already supported in Chrome 64 and later.

https://github.com/tc39/proposal-regexp-named-groups
https://github.com/tc39/proposal-regexp-lookbehind
https://github.com/tc39/proposal-regexp-unicode-property-escapes

Unfortunately, the Dart VM/AOT compiler version of RegExp (i.e. when not compiled to JS) doesn't seem to support them, so the statement "Dart regular expressions have the same syntax and semantics as JavaScript regular expressions" isn't really true anymore. Some regular expressions work on Dartpad, but not in Flutter, for instance.

Dart should implement these too: they're also super useful.

Metadata

Metadata

Assignees

Labels

area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions