Description
The app crashes only on iOS 11.2 giving me unhandled JS Exception: Invalid regular expression: unrecognized character after (?
while not in debug mode.
I've tested the same code on iOS 13 and it works fine. I eventually figured out which regex were causing the problem and I found out that all regex of this type (?<value>\d{2}\/\d{2}\/\d{4})
were causing the crash they are stored as value of a Javascript Object in a separate .js file. I'm asking for a solution that doesn't require changing all the regex.
I don't understand why the behaviour on iOS 13 is different from iOS 11.2.
Also I found a similar issue with lookbehind regex at this link Crash if not in debug on android and iOS.
What I've already tried
- First thing first I tried to update React Native to the latest version 0.61.5, but it didn't solve my issue
- I've tried to replicate the same issue in a fresh new project and it didn't crash
- Tried to remove all the regex, this worked, but the regex are part of a big and important functionality of the app
Environment
System:
OS: macOS 10.15.2
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Memory: 461.18 MB / 16.00 GB
Binaries:
Node: 13.3.0 - /usr/local/Cellar/node/13.3.0/bin/node
Yarn: 1.19.2 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5977832
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: ^0.60.5 => 0.60.5
npmGlobalPackages:
react-native-cli: 2.0.1
Screenshots
Thanks for reading