Extension talk:Regex Fun

About this board

"Indirect modification" error after 1.37.4 upgrade

4
Huwmanbeing (talkcontribs)

I updated my installation today from 1.35 to 1.37.4 and am now seeing this error message related to Regex Fun:

Notice: Indirect modification of overloaded property Parser::$mExtRegexFun has no effect in /var/www/my.wiki/public_html/mediawiki-1.37.4/extensions/RegexFun/RegexFun.php on line 727

Also seeing this:

Notice: Undefined property: Parser::$mExtRegexFun in /var/www/my.wiki/public_html/mediawiki-1.37.4/includes/debug/DeprecationHelper.php on line 209

I'm not sure why this started popping up; has anyone encountered this before? I grabbed the extension for 1.37 and have run all the normal updates, and this seems to be the only extension having issues. Any assistance greatly appreciated!

Huwmanbeing (talkcontribs)

Never mind: I continued my system upgrade to the latest (1.38.2) and now the Regex Fun error has disappeared, so hey-ho! Huwmanbeing (talk) 09:53, 5 September 2022 (UTC)

Lokipr (talkcontribs)

Hello

I updated to 1.39.1 and i have the same error Parser::$mExtRegexFun.

Valerio Bozzolan (talkcontribs)
Reply to ""Indirect modification" error after 1.37.4 upgrade"

"Undefined property: Parser::$mExtRegexFun" error after 1.39.0 upgrade

1
Morikawa56 (talkcontribs)

I have the same problem that Notice: Undefined property: Parser::$mExtRegexFun in /www/wwwroot/my.wiki/includes/debug/DeprecationHelper.php on line 211


I have too many teamplate used the function.I can't remove it so esaily.

Reply to ""Undefined property: Parser::$mExtRegexFun" error after 1.39.0 upgrade"

Deprecation warning for MW>=1.22

1
Sm8ps (talkcontribs)

On MW 1.31 I see the following warning: "Use of ParserLimitReport hook (used in ExtRegexFun::onParserLimitReport) was deprecated in MediaWiki 1.22."

Reply to "Deprecation warning for MW>=1.22"

Parse video ID from youtube Link

2
Nischayn22 (talkcontribs)

I am trying to get the video ID from a youtube link using this extension but have failed. If anyone has done this please share.

Danwe (talkcontribs)

Have a look at this StackOverflow question. As you can see there are various answers and comments so I just picked one (not necessarily the best or most suitable for you) of the described solutions there. Keep in mind that there is a chance that this might not work with all future youtube IDs if Google changes the format.

This should give you an empty string if no valid youtube url is given and the video ID if a valid url is given (not tested):

{{#regex: URL HERE | /^.*(?:youtu.be\/{{!}v\/{{!}e\/{{!}u\/\w+\/{{!}embed\/{{!}v=)([^#\&\?]*).*/ir | $1 }}

Reply to "Parse video ID from youtube Link"
193.8.201.1 (talkcontribs)

Please show some example code, snippet.. with regex_var function because there is misunderstood how to manipulate with regex_var ..

Reply to "regex_var"
213.30.140.219 (talkcontribs)

How can you specify alternation (|) in the pattern for #regex? e.g. if you want to match {{ #regex: abcdef | /abc|def/ }} ? Alternatives such as calling #regex twice won't work for me.

Danwe (talkcontribs)

Two possible ways:

  • Define a Template:! in your wiki which contains nothing move than a |. Then use {{ #regex: abcdef | /abc{{!}}def/ }}.
  • Use the regex ascii escaping syntax. Without looking it up, \x7C should work if I am not misstaken. {{ #regex: abcdef | /abc\x7Cdef/ }}.
Reply to "Alternation"
74.255.33.135 (talkcontribs)

How can I get this to parse the content of a variable?

Using the Variables Extension.

{{#vardefine:cur|Current user rating: 4 (1 rating)}}

The variable cur contains variable text that can look like "Current user rating: 4 (1 rating)".

Why doesn't this work?


{{#regex: {{#var:cur}} |/^.*rating: ([0-9]+\.?[0-9]*).*$/|$1}}

that returns something like "1461dee31c1648-item-1--QINU" which changes every refresh.

Thanks for the awesome extension.

Danwe (talkcontribs)

I can not confirm this.

{{#vardefine:cur|Current user rating: 4 (1 rating)}}
{{#regex: {{#var:cur}} |/^.*rating: ([0-9]+\.?[0-9]*).*$/ | $1}}

produces 4 using the current (trunk) version of Variables and Regex Fun. The "1461dee31c1648-item-1--QINU" thing you are writing about looks like a internal strip marker, something went utterly wrong there. But I can't believe this is due to simple variables/regex usage, perhaps you are using some strange version or something is interfering? Which version do you use?

Kghbln (talkcontribs)

I have seen this QINU problem before. Perhaps it is related, though I basically have no clue. Cheers

Accidently I saw another edit todoy which said: "The parser hook must return a value in MW 1.18+, so return the empty string" with return htmlspecialchars(""); Still I do not know if this is the cause of this problem.

Reply to "Parse variable"
There are no older topics