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
+3.8k Facebook : How to place save to Facebook button on your website
+8.6k Golang : Validate IPv6 example
+6.8k Golang : Error reading timestamp with GORM or SQL driver
+4.4k PHP : Hide PHP version information from curl
+4.7k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
+14.2k Golang : Get current time from the Internet time server(ntp) example
+8.6k Golang : Turn string or text file into slice example
+6.8k Golang : Scan files for certain pattern and rename part of the files
+5.6k Golang : Totalize or add-up an array or slice example
+10.6k Golang : Convert decimal number(integer) to IPv4 address
+10.6k Golang : Gorilla web tool kit secure cookie example