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
+10.8k CodeIgniter : How to check if a session exist in PHP?
+5k Golang : Reclaim memory occupied by make() example
+9k Mac OSX : Get a process/daemon status information
+44.1k Golang : Use wildcard patterns with filepath.Glob() example
+6.2k Golang : Combine slices of complex numbers and operation example
+3.2k Golang : Switch Redis database redis.NewClient
+8.9k Golang : How to control fmt or log print format?
+4.7k Golang : Get a list of crosses(instruments) available to trade from Oanda account
+19.6k Golang : Compare floating-point numbers
+8.9k Golang : How to check if a string with spaces in between is numeric?
+40.8k Golang : How do I convert int to uint8?
+11.2k Golang : Change date format to yyyy-mm-dd