Help talk:Extension:Arrays

About this board

Dinoguy1000 (talkcontribs)

I've tested several regex fragments for the purpose of defining an array with a series of one-character items and without any empty items, and this is the only one I've found that works. For some reason, most of them that seem like they should work, instead just result in an array with one more item than the number of characters in the input (e.g. if the input string is 10 characters, the array will be 11), and where every item is empty. For comparison, here are the fragments I've tested and the result of using them in the code {{ #arraydefine: digits | 0123456789 | regex }}{{ #arraysize: digits }}: [{{ #arrayprint: digits }}]:

Regex Result
// 12: [, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]
/(?<=\w)(?=\w)/ 10: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
/./ 11: [, , , , , , , , , ,]
/.+/ 2: [,]
/.{1}/ 11: [, , , , , , , , , ,]
/../ 6: [, , , , ,]
/\w/ 11: [, , , , , , , , , ,]
/\w+/ 2: [,]
/\w{1}/ 11: [, , , , , , , , , ,]
/\w\w/ 6: [, , , , ,]
/[\w]/ 11: [, , , , , , , , , ,]
/[0-9]/ 11: [, , , , , , , , , ,]
/[^]/ 1: [0123456789]

if anyone has ideas for other ones to try, or tries any others themselves, please post them here, especially if you find a different fragment that actually works. Also, if anyone tests on a different version of PHP/MediaWiki/Extension:Arrays than I did (PHP 7.2.13-1+ubuntu16.04.1+deb.sury.org+1 (fpm-fcgi); MediaWiki 1.31.1; Ext:Arrays 2.1.0 (4a04cd6)), and gets different results, please post here along with your wiki's configuration.

Reply to "/(?<=\w)(?=\w)/"
There are no older topics
Return to "Extension:Arrays" page.