Module talk:Lang-zh: Difference between revisions

Content deleted Content added
Line 152:
In <syntaxhighlight>{{zh|t=竹子林站|j=Zuk1 Zi2 Lam4 Zaam6|l = '''Bamboo Forest station'''}}</syntaxhighlight>, the opening bold markup is properly removed, but the trailing bold markup is not removed. It looks like the regular expression at <syntaxhighlight>term = string.gsub(term, "^([ \"']*)(.*)([ \"']*)$", "%2")</syntaxhighlight> needs some adjustment to the middle wildcard search. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 13:23, 16 September 2024 (UTC)
 
:This is because the * operator is greedy, so .* matches everything else in the string. Changing .* to .*? would make it lazy, so that the final term catches all trailing characters. In other words, change the line of code to: <syntaxhighlight>term = string.gsub(term, "^([ \"']*)(.*?)([ \"']*)$", "%2")</syntaxhighlight> [[User:Freelance Intellectual|Freelance Intellectual]] ([[User talk:Freelance Intellectual|talk]]) 13:51, 16 September 2024 (UTC)
:'''
:term = string.gsub(term, "^([ \"']*)(.*?)([ \"']*)$", "%2")
:''' [[User:Freelance Intellectual|Freelance Intellectual]] ([[User talk:Freelance Intellectual|talk]]) 13:51, 16 September 2024 (UTC)