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
+9.5k Facebook : Getting the friends list with PHP return JSON format
+6.7k Golang : Experimental emojis or emoticons icons programming language
+32.2k Golang : Convert []string to []byte examples
+12.5k Golang : "https://" not allowed in import path
+19.2k Golang : Check whether a network interface is up on your machine
+7.1k Nginx : How to block user agent ?
+15.2k Golang : Get HTTP protocol version example
+8.7k Golang : How to join strings?
+5.3k Javascript : Change page title to get viewer attention
+4.6k Mac OSX : Get disk partitions' size, type and name
+5.1k Swift : Convert (cast) Float to Int or Int32 value
+5.3k Golang : Get FX sentiment from website example