Q:

Regex: Match up to character, abort if contains word

I have a document like
@ManyToOne
@JoinColumn(name = "p_id_1", referencedColumnName = "id", insertable=false, updateable = false)

@ManyToOne
@JoinColumn(name = "p_id_2", referencedColumnName = "id")

I am trying to design a regex that matches from @ManyToOne to ) (excluded) but does not match if the line contains , insertable
After trying around I ended up with @ManyToOne\n.+?(?=, insertable|\)) but this also matches a part of the first lines. What I want it to do is not matching the first two lines and the second two lines only up to the )
As a sidenote: I am using it in a Gradle-Build-Script written in Groovy.

A:

I'd use negative lookarounds to make sure the match breaks on encountering , insertable, and a positive lookahead to exclude the closing bracket, something like:
@ManyToOne\n((?!, insertable).)*?(?=\))

