Jump to content
MediaWiki

Topic on Extension talk:RegexFunctions/Archive 2

Migrating from Regex Fun to RegexFunctions

4
Summary by Jaideraf

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

Jaideraf (talk contribs )

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 (talk contribs )

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 (talk contribs )

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

Loizbec (talk contribs )

I had the same problem after migrating from regexp fun.

I think that comes from having = in an unnamed parameter. I resorted to creating a Template:= to be able to display an '=' sign in my replacement field...

In the end, it would be better not to allow named parameters, if it makes using = sign in the regexps impossible...

AltStyle によって変換されたページ (->オリジナル) /