Golang : error parsing regexp: invalid or unsupported Perl syntax
Compiling and running Golang program will throw out some odd error messages sometimes. Got one today with this error message below while testing out regular expressions in Golang :
error parsing regexp: invalid or unsupported Perl syntax: (?!
Apparently it was because Perl syntax and negative lookahead is not supported in Golang. Golang's Regular Expression syntax is different from PCRE's (which is used by php and javascript ).
To fix this you can either convert your regular expression to non-Perl syntax style or install https://github.com/tuxychandru/golang-pkg-pcre/
If you requirement is not too complex, you can also consider the Golang unicode
package. There are couple of functions such as IsDigit, IsNumber and IsPunct that might be useful.
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+8.3k Android Studio : Import third-party library or package into Gradle Scripts
+21.8k Fix "Failed to start php5-fpm.service: Unit php5-fpm.service is masked."
+9.5k Golang : Format strings to SEO friendly URL example
+18.5k Unmarshal/Load CSV record into struct in Go
+9k Golang : does not implement flag.Value (missing Set method)
+18.4k Golang : Set, Get and List environment variables
+4.8k Golang : micron to centimeter example
+13.4k Golang : Set image canvas or background to transparent
+16.2k Golang : Execute terminal command to remote machine example
+4.5k Unix/Linux : How to pipe/save output of a command to file?
+6.6k Golang : Get expvar(export variables) to work with multiplexer
+4.9k Swift : Convert (cast) Float to Int or Int32 value