General questions about using TextPad
Moderators: AmigoJack , bbadmin , helios , Bob Hansen , MudGuard
kengrubb
Posts: 324 Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA
Post
by kengrubb » Thu Jul 22, 2021 7:54 pm
I'm trying to match on a SQL INSERT statement, but only up to the first GO statement. I think I need Negative Lookbehind assist, but I could not make it work.
This will keep finding until the LAST GO statement, but I only want the NEXT GO statement after the INSERT.
insert +into +dbo.account .*GO
(2[Bb]|[^2].|.[^Bb])
That is the question.
MudGuard
Posts: 1295 Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:
Post
by MudGuard » Thu Jul 22, 2021 8:55 pm
maybe ungreediness might help (hard to say without the text you want to match).
Ungreedy version of your regex:
(i.e. add a ? to the quantifiers + or * where you don't want greedy version ...)
kengrubb
Posts: 324 Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA
Post
by kengrubb » Thu Jul 22, 2021 10:57 pm
That was the trick, Mudguard! Many thanks! You truly Grok in Full!
(2[Bb]|[^2].|.[^Bb])
That is the question.
AmigoJack
Posts: 532 Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:
Post
by AmigoJack » Fri Jul 23, 2021 8:27 am
If you guys had backslashes in your regex (i.e. dbo\.account ) then those are killed by the forum software.