I am reporting this bug in response to a discussion in [gnome-terminal][1]. It looks like there has possibly been a regression from EOAN to FOCAL in pcre2.
Given the following regex:
<code>(?<APOS_START>(?<='))?" "(?(DEFINE)(?<S4>(?x: (?: [0-9] | [1-9][0-9] | 1[0-9]{2} | 2[0-4][0-9] | 25[0-5] ) (?! [0-9] ) )))" "(?(DEFINE)(?<IPV4>(?x: (?: (?&S4) \\. ){3} (?&S4) )))" "(?(DEFINE)(?<S6>[[:xdigit:]]{1,4})(?<CS6>:(?&S6))(?<S6C>(?&S6):))" "(?(DEFINE)(?<IPV6>(?x: (?: " "(?x: :: )" " | " "(?x: : (?&CS6){1,7} )" " | " "(?x: (?! (?: [[:xdigit:]]*: ){8} ) (?&S6C){1,6} (?&CS6){1,6} )" " | " "(?x: (?&S6C){1,7} : )" " | " "(?x: (?&S6C){7} (?&S6) )" " | (?: " "(?x: (?&S6C){6} )" " | " "(?x: :: (?&S6C){0,5} )" " | " "(?x: (?! (?: [[:xdigit:]]*: ){7} ) (?&S6C){1,4} (?&CS6){1,4} ) :" " | " "(?x: (?&S6C){1,5} : )" " ) (?&IPV4) ) (?! [.:[:xdigit:]] ) )))" "(?(DEFINE)(?<PATH_INNER>(?x: (?: " "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%'\\E]" "* (?: \\( (?&PATH_INNER) \\) | \\[ (?&PATH_INNER) \\] ) )* " "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%'\\E]" "* )))" "(?(DEFINE)(?<PATH>(?x: (?: " "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%'\\E]" "* (?: \\( (?&PATH_INNER) \\) | \\[ (?&PATH_INNER) \\] ) )* (?: " "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%'\\E]" "* (?(<APOS_START>)" "[-[:alnum:]\\Q_$+*:@&=/~#|%\\E]" "|" "[-[:alnum:]\\Q_$+*:@&=/~#|%'\\E]" ") )? )))" "(?<!(?:" "(?x: [-[:alnum:]] | (?! [[:ascii:]] ) [[:graph:]] )" "|[.]))(?=(?i:www|ftp))" "(?x: (?: " "(?x: [-[:alnum:]] | (?! [[:ascii:]] ) [[:graph:]] )" "+ \\. )* " "(?x: [-[:alnum:]] | (?! [[:ascii:]] ) [[:graph:]] )" "* (?! [0-9] ) " "(?x: [-[:alnum:]] | (?! [[:ascii:]] ) [[:graph:]] )" "+ )" "(?x: \\:" "(?x: (?: [1-9][0-9]{0,3} | [1-5][0-9]{4} | 6[0-4][0-9]{3} | 65[0-4][0-9]{2} | 655[0-2][0-9] | 6553[0-5] ) (?! [0-9] ) )" " )?" "(?x: /(?&PATH) )?</code>
And the following input:
www.foo.bar/baz
WWW3.foo.bar/baz
FTP.FOO.BAR/BAZ
ftpxy.foo.bar/baz
The regex should match but does actually not match.
In EOAN this still worked as I have just confirmed in a virtual machine.
[1]: https://gitlab.gnome.org/GNOME/gnome-terminal/issues/221
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: libpcre2-8-0 10.34-7
ProcVersionSignature: Ubuntu 5.4.0-14.17-generic 5.4.18
Uname: Linux 5.4.0-14-generic x86_64
ApportVersion: 2.20.11-0ubuntu17
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sun Feb 23 15:49:32 2020
InstallationDate: Installed on 2020-02-04 (18 days ago)
InstallationMedia: Ubuntu 19.10 "Eoan Ermine" - Release amd64 (20191017)
SourcePackage: pcre2
UpgradeStatus: Upgraded to focal on 2020-02-22 (0 days ago)
Status changed to 'Confirmed' because the bug affects multiple users.