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
+7.8k Golang : Test if an input is an Armstrong number example
+25.9k Golang : How to write CSV data to file
+7.5k Golang : Word limiter example
+5.6k Gogland : Datasource explorer
+11.9k How to tell if a binary(executable) file or web application is built with Golang?
+5.3k Swift : Convert (cast) Float to Int or Int32 value
+16.6k Golang : Send email and SMTP configuration example
+15.8k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+7.4k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+16.6k Golang : File path independent of Operating System
+7.7k Golang : Detect sample rate, channels or latency with PortAudio
+30.6k Golang : How to verify uploaded file is image or allowed file types