Page 1 of 1

Regex question

Posted: 01 Dec 2021 08:15
by RalphM
Why does "\t" work to match a tab in the find part of the below regex but not in the substitution part where I had to use <tab> instead?

Code: Select all

$sInput = regexreplace($sInput, "^(\d{4}-\d{2}-\d{2})\t(\d{2}:\d{2}:\d{2})\t{3}(.*\b(\d{3,}), User (\d{2,4}).*)$", "$1<tab>$2<tab>$4<tab>$5<tab>$3");

Re: Regex question

Posted: 01 Dec 2021 08:33
by highend
Because the substitution part or this regex engine doesn't know any specialties like more modern do

Re: Regex question

Posted: 01 Dec 2021 11:14
by RalphM
So assuming that it does what PHP before version 7.3 did is obviously not true in all regards?

"regex101" helped me a lot with regex but doesn't seem to offer any "older" flavors of PHP regex engine.
PicPick_630.jpg
PicPick_630.jpg (66.03 KiB) Viewed 1476 times

Re: Regex question

Posted: 01 Dec 2021 11:51
by highend
What does that have to do with PHP? It's the VB6 engine that's used here

Re: Regex question

Posted: 01 Dec 2021 13:11
by RalphM
Well, I thought since scripting is based on PHP syntax that the regex engine would follow that line as well.