Page 1 of 1
Crash using this Regex: ^D*(d+)D*$
Posted: Tue Aug 10, 2021 7:50 pm
by kengrubb
I tried changing this:
^\D*(\d+)\D*$
To this:
$1
And crash
Posted: Tue Aug 10, 2021 7:54 pm
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)
Posted: Tue Aug 10, 2021 8:16 pm
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.
to then replace that by
$1?
Posted: Tue Aug 10, 2021 8:30 pm
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.