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
+7.9k Golang : Ways to recover memory during run time.
+16.6k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+8.9k Golang : Accept any number of function arguments with three dots(...)
+4.7k Linux : sudo yum updates not working
+21.3k Golang : Clean up null characters from input data
+11.3k Golang : Characters limiter example
+18.9k Golang : Read input from console line
+22.2k Golang : Securing password with salt
+40.6k Golang : Convert to io.ReadSeeker type
+29.5k Golang : Saving(serializing) and reading file with GOB
+7.4k Golang : How to convert strange string to JSON with json.MarshalIndent