Skip to content

Instantly share code, notes, and snippets.

@serverhorror
Last active April 20, 2017 09:18
Show Gist options
  • Save serverhorror/fef6e76a6d6af1edf9abc3bdc66ba7db to your computer and use it in GitHub Desktop.
Save serverhorror/fef6e76a6d6af1edf9abc3bdc66ba7db to your computer and use it in GitHub Desktop.
// Unsupported Pattern because of negative look-ahead
// PATTERN = "(.*?)((BI)-(\w+)-(\d{4}-\d{4}-\d{4}(?!-\d{4})))"
// Workaround?
for _, line := range lines {
// If we have 3 digit groups we found a candidate!
if match, _ := regexp.MatchString("(.*?)((BI)-(\w+)-(\d{4}-\d{4}-\d{4}", text); match == true {
// But if we have 4 digit groups this shouldn't be handled!
// This is what the negative lookahead would prevent in the first place
if match, _ := regexp.MatchString("(.*?)((BI)-(\w+)-(\d{4}-\d{4}-\d{4}-\d{4}", text); match == true {
continue
}
handle(line)
}
}
func handle(line string) {
return // magic
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment