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
+13.8k Golang : How to check if a file is hidden?
+10k Golang : Check a web page existence with HEAD request example
+20.3k Golang : Pipe output from one os.Exec(shell command) to another command
+8.1k Prevent Write failed: Broken pipe problem during ssh session with screen command
+13.3k Golang : Read XML elements data with xml.CharData example
+30.2k Golang : How to redirect to new page with net/http?
+9.6k Random number generation with crypto/rand in Go
+13.2k Golang : Linear algebra and matrix calculation example
+7.4k Gogland : Single File versus Go Application Run Configurations
+15.1k Golang : Get all local users and print out their home directory, description and group id
+21.6k Golang : Upload big file (larger than 100MB) to AWS S3 with multipart upload
+23.9k Golang : Find biggest/largest number in array