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
+6.7k Golang : Totalize or add-up an array or slice example
+6.5k Golang : Break string into a slice of characters example
+10k Golang : Translate language with language package example
+5.9k Golang : Find change in a combination of coins example
+5k Unix/Linux : secure copying between servers with SCP command examples
+22.9k Golang : Set and Get HTTP request headers example
+9.8k Golang : Populate slice with sequential integers example
+8.5k Golang : Auto-generate reply email with text/template package
+8k Swift : Convert (cast) String to Double
+9.6k Mac OSX : Get a process/daemon status information
+40.8k Golang : Convert to io.ReadSeeker type
+22k Golang : Upload big file (larger than 100MB) to AWS S3 with multipart upload