Extension talk:RegexFunctions

About this board

Previous discussion was archived at Extension talk:RegexFunctions/Archive 1 on 2020-03-22.

Migrating from Regex Fun to RegexFunctions

3
Summary by Jaideraf

Using unnamed parameters ({{#rmatch:|||}}) does not work, but using named ones does ({{#rmatch:|pattern=|then=|else=}}).

Jaideraf (talkcontribs)

Hi @Skizzerz, I am migrating from the Regex Fun extension to the RegexFunctions extension, but I couldn't get the same result from this regex, could you please help me?


Input: $a São Paulo :$b Fundação Perseu Abramo,$c 2013.

Result expected: Fundação Perseu Abramo,


Regex Fun:

{{#regex:$a São Paulo : $b Fundação Perseu Abramo, $c 2013.|/\$b(.*?)(?=\$){{!}}\$b(.*)/}}

Result: Fundação Perseu Abramo,

RegexFunctions:

{{#rmatch:$a São Paulo : $b Fundação Perseu Abramo, $c 2013.|/\$b(.*?)(?=\$){{!}}\$b(.*)/|$1}}

Result: (nothing)

Maaartyyynaa (talkcontribs)

try {{#rmatch:$a São Paulo: $b Fundação Perseu Abramo, $c 2013.|pattern=/\$b(.*?)(?=\$)|\$b(.*)/|then=$1|else=failure}} as a result I got Fundação Perseu Abramo,

Jaideraf (talkcontribs)

Thank you! You just have solved the mystery. Using unnamed parameters does not work, but using named ones does. Interesting.

Reply to "Migrating from Regex Fun to RegexFunctions"

#rsplit shows last piece, even when piece number is greater than last

1
ZyMOS (talkcontribs)

When looping through all pieces using #rsplit there is no easy way to know when your at the end.

for example

#rsplit: bob,taco,beep|,|

piece 1: bob

piece 2:taco

piece 3:beep

piece 4:beep

piece 5:beep

...

Reply to "#rsplit shows last piece, even when piece number is greater than last"

Where is the extension.json file?

2
Qpn6ph9q (talkcontribs)

There is no extension.json file in the tarball. This causes the wiki to abort with an error when the extension is loaded as directed.


PHP message: PHP Fatal error:  Uncaught Exception: Unable to open file /path/to/RegexFunctions/extension.json

Qpn6ph9q (talkcontribs)

I eventually found it on the github repo.

Reply to "Where is the extension.json file?"
There are no older topics