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
+12k Golang : How to display image file or expose CSS, JS files from localhost?
+13.8k Golang : Fix image: unknown format error
+18.9k Golang : Calculate entire request body length during run time
+5k Golang : The Tao of importing package
+14.3k Golang : Rename directory
+8.9k nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
+17.2k Golang : Multi threading or run two processes or more example
+11.1k Android Studio : Create custom icons for your application example
+9.1k Golang : How to get garbage collection data?
+15k Golang : Get query string value on a POST request
+28.9k Golang : Saving(serializing) and reading file with GOB
+15.5k Golang : Get current time from the Internet time server(ntp) example