Crash using this Regex: ^D*(d+)D*$

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Crash using this Regex: ^D*(d+)D*$

Post by kengrubb »

I tried changing this:
^\D*(\d+)\D*$

To this:
$1

And crash
Last edited by kengrubb on Tue Aug 10, 2021 8:32 pm, edited 1 time in total.
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

Here is a sample of the text. SQL Server Message Results, and I was trying to get just the numbers to add them up [by then copy and pasting into Excel].

(1000 rows affected)

(1000 rows affected)

(1000 rows affected)

(1000 rows affected)

(1000 rows affected)

(1000 rows affected)

(1000 rows affected)

(1000 rows affected)
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
AmigoJack
Posts: 515
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

I bet that is not the regex you wanted to post, because without the backslashes you surely are unable to get numbers. See This phpBB installation falls apart.

Your regex might match its result itself (think about it: you remove potential leading and trailing non-numbers, to then have a clean number left - but that's also something that matches what you search for). Why not matching something that won't catch the outcome again? I.e.

Code: Select all

^\((\d+) rows.+$
to then replace that by $1?
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

AmigoJack wrote:I bet that is not the regex you wanted to post, because without the backslashes you surely are unable to get numbers.
Yours works, but I'm puzzled why mine blew up TP. I tried it in Expresso, and it understood it. Tried it in another tool, and it worked fine.

Update: Now I'm seeing that it stripped the backslashes when I posted.
(2[Bb]|[^2].|.[^Bb])

That is the question.
Post Reply