Jump to content




fs.find wildcards


  • You cannot reply to this topic
16 replies to this topic

#1 apemanzilla

  • Members
  • 1,421 posts

Posted 14 April 2014 - 05:27 PM

Could anyone provide a list of acceptable patterns and wildcards for use with fs.find? I'm making a pure-Lua implementation of it for one of my projects. All I could find so far was the '*' wildcard.

#2 Lignum

  • Members
  • 558 posts

Posted 14 April 2014 - 06:40 PM

I don't think there are any others since none are documented on the wiki besides from the asterisk. I have the source in front of me.. but I don't know how regexes work (should I be ashamed?). And I'm assuming it wouldn't be okay to post the source here for someone that understands them to decipher, so I won't.

#3 apemanzilla

  • Members
  • 1,421 posts

Posted 14 April 2014 - 06:54 PM

View PostLignum, on 14 April 2014 - 06:40 PM, said:

I don't think there are any others since none are documented on the wiki besides from the asterisk. I have the source in front of me.. but I don't know how regexes work (should I be ashamed?). And I'm assuming it wouldn't be okay to post the source here for someone that understands them to decipher, so I won't.
Well I just tested and ? seems to work too...
fs.find("rom/????/gps") finds rom/apis/gps and rom/help/gps...

Edited by Apemanzilla, 14 April 2014 - 06:55 PM.


#4 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

Posted 14 April 2014 - 06:59 PM

Pure guessing here but it would make sense
* - one or more wildcards
? - one wildcard

Wonder if there are other unknown ones.

Edited by wojbie, 14 April 2014 - 06:59 PM.


#5 apemanzilla

  • Members
  • 1,421 posts

Posted 14 April 2014 - 07:00 PM

View Postwojbie, on 14 April 2014 - 06:59 PM, said:

Pure guessing here but it would make sense
* - one or more wildcards
? - one wildcard

Wonder if there are other unknown ones.
Those two are correct, but I'm still trying to see if there are others.

#6 Lignum

  • Members
  • 558 posts

Posted 14 April 2014 - 07:02 PM

'.' seems to do the same as '?'.
EDIT: There's a Lua implementation of the function in Gamax's version of cclite here on line 687. '?', '.' and '*' seem to be all of them.

Edited by Lignum, 14 April 2014 - 07:09 PM.


#7 apemanzilla

  • Members
  • 1,421 posts

Posted 14 April 2014 - 07:04 PM

View PostLignum, on 14 April 2014 - 07:02 PM, said:

'.' seems to do the same as '?'.
Could someone try '-'? On my iPad right now.

#8 Lignum

  • Members
  • 558 posts

Posted 14 April 2014 - 07:09 PM

View PostApemanzilla, on 14 April 2014 - 07:04 PM, said:

Could someone try '-'? On my iPad right now.

I've created three files in root named '1', '2' and '3'.

fs.find("[1-3]")

seems to find all of them.

Edited by Lignum, 14 April 2014 - 07:10 PM.


#9 apemanzilla

  • Members
  • 1,421 posts

Posted 14 April 2014 - 07:29 PM

View PostLignum, on 14 April 2014 - 07:09 PM, said:

View PostApemanzilla, on 14 April 2014 - 07:04 PM, said:

Could someone try '-'? On my iPad right now.

I've created three files in root named '1', '2' and '3'.

fs.find("[1-3]")

seems to find all of them.
So I guess it's using string patterns...

Try the same three files and fs.find("%d") please? :P

Edited by Apemanzilla, 14 April 2014 - 07:29 PM.


#10 Lignum

  • Members
  • 558 posts

Posted 14 April 2014 - 07:41 PM

View PostApemanzilla, on 14 April 2014 - 07:29 PM, said:

So I guess it's using string patterns...

Try the same three files and fs.find("%d") please? :P

Yes, it seems to find all three of them.

#11 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 14 April 2014 - 07:44 PM

For whatever reason none of them work for me. Only the asterisk (*). But if I'm correct I would say here is a list of what should work.

#12 Lignum

  • Members
  • 558 posts

Posted 14 April 2014 - 08:22 PM

View PostMKlegoman357, on 14 April 2014 - 07:44 PM, said:

For whatever reason none of them work for me. Only the asterisk (*). But if I'm correct I would say here is a list of what should work.
That's probably the case since Pattern.compile is what the source code uses.

#13 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 14 April 2014 - 08:23 PM

Anyone knows why nothing works for me? I'm using CC 1.62.

#14 Lignum

  • Members
  • 558 posts

Posted 14 April 2014 - 09:04 PM

View PostMKlegoman357, on 14 April 2014 - 08:23 PM, said:

Anyone knows why nothing works for me? I'm using CC 1.62.
They only seem to work on cclite. I can't use them on CC1.62 either.

#15 apemanzilla

  • Members
  • 1,421 posts

Posted 14 April 2014 - 09:06 PM

View PostLignum, on 14 April 2014 - 09:04 PM, said:

View PostMKlegoman357, on 14 April 2014 - 08:23 PM, said:

Anyone knows why nothing works for me? I'm using CC 1.62.
They only seem to work on cclite. I can't use them on CC1.62 either.
Interesting. I'll test more out later.

#16 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 14 April 2014 - 09:10 PM

View PostLignum, on 14 April 2014 - 09:04 PM, said:

View PostMKlegoman357, on 14 April 2014 - 08:23 PM, said:

Anyone knows why nothing works for me? I'm using CC 1.62.
They only seem to work on cclite. I can't use them on CC1.62 either.

Ah, well that would explain everything :D. I thought it was something wrong with my Java. That's why I use MC with real CC to test things. cclite's implementation uses regular Lua's string matching capabilities, so any Lua patterns would work.

#17 apemanzilla

  • Members
  • 1,421 posts

Posted 15 April 2014 - 01:55 PM

Alright, in further testing it appears that in regular CC, only the * wildcard is accepted. Others may be available in emulators.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users