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
+29.1k Golang : missing Git command
+18.6k Golang : Find IP address from string
+5.2k Python : Convert(cast) string to bytes example
+16.8k Golang : How to generate QR codes?
+17.5k Golang : delete and modify XML file content
+13.3k Golang : Generate Code128 barcode
+12.5k Golang : Transform comma separated string to slice example
+6.9k Golang : Gargish-English language translator
+10.2k Golang : Detect number of faces or vehicles in a photo
+16.5k Golang : Delete files by extension
+11.5k CodeIgniter : Import Linkedin data
+17.4k Golang : Get future or past hours, minutes or seconds