Regex question

Discuss and share scripts and script files...
Post Reply
RalphM
Posts: 1929
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Regex question

Post 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");
Ralph :)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Regex question

Post by highend »

Because the substitution part or this regex engine doesn't know any specialties like more modern do
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

RalphM
Posts: 1929
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Regex question

Post 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 1213 times
Ralph :)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Regex question

Post by highend »

What does that have to do with PHP? It's the VB6 engine that's used here
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

RalphM
Posts: 1929
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Regex question

Post by RalphM »

Well, I thought since scripting is based on PHP syntax that the regex engine would follow that line as well.
Ralph :)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)

Post Reply