Wikipedia talk:WikiProject JavaScript: Difference between revisions

Content deleted Content added
Nested RegExp: Added response
Line 191:
 
:Cheers, [[User:Jdh8|Chen-Pang He]] ([[User talk:Jdh8|talk]]) <!--Template:Undated--><small class="autosigned">—Preceding [[Wikipedia:Signatures|undated]] comment added 15:19, 6 May 2017 (UTC)</small> <!--Autosigned by SineBot-->
 
:: )
 
I got your message. It looks like you may have gotten the help you need. When working with RegExp, I like to try them on some sample strings to see what each one is actually matching, and what it's returning. There's a great website for doing that: [https://regex101.com/ regex101]. [[User:Nathanm mn|Nathanm mn]] ([[User talk:Nathanm mn|talk]]) 16:12, 6 May 2017 (UTC)
 
: {{ping|Nathanm mn}} We still haven't figured it out. The problem I'm trying to solve is how to identify when a list item has a child. A child list item will have one more asterisk at the beginning than the parent. So, I set up a capturing group for the asterisks at the beginning of the parent (so $1 would be the back reference), and then try to match that number of asterisks plus one more in the child (using $1\*). But it isn't working. I am stuck. There are other criteria which the entries to be removed must fail, otherwise I wish to keep them. So simply getting rid of all children isn't what I'm after. We already know they are red linked entries, because the first half of the program puts all redlinks into an array, which we process in the second half of the program. Then the nested if structure checks first for whether the current redlink in the array has no entry. If it doesn't, then we check to see if it has no colon annotation. If it doesn't have a colon separator, then we check to see if it doesn't have a hyphenated annotation. If it doesn't have an en dash separator, then we check to see if it has no children. If it doesn't have a child, then we delete it from the wiki source, modifying the actual article itself.
: Once all redlinked entries that fail our tests are removed, then the rest of the program mops up, deleting red category links, and delinking all redlinks that still remain after that. We know, due to the extensive filtering we just subjected them to, that they are all embedded redlinks, the content of which we want to keep. I'll make a sample below that presents examples of the data instances to be processed. [[User talk:The Transhumanist|<i>The&nbsp;Transhumanist</i>]] 22:12, 6 May 2017 (UTC)
 
== Use of Wikipedian programmer categories ==