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
+11k Golang : How to flush a channel before the end of program?
+4.5k Python : Find out the variable type and determine the type with simple test
+7.2k SSL : How to check if current certificate is sha1 or sha2 from command line
+22.6k Golang : Get ASCII code from a key press(cross-platform) example
+12.8k Golang : How to get a user home directory path?
+12.5k Golang : Convert int(year) to time.Time type
+54.5k Golang : Unmarshal JSON from http response
+6k Golang : Extract sub-strings
+11.4k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+11.5k Golang : Find and draw contours with OpenCV example
+10.5k PHP : Convert(cast) bigInt to string
+9k Golang : Launch Mac OS X Preview (or other OS) application from your program example