Searching for anything that starts with anyletters + s

General discussion related to "Everything".
filipeteles
Posts: 18
Joined: Thu Mar 24, 2016 9:53 am

Searching for anything that starts with anyletters + s

Postby filipeteles » Thu Sep 14, 2017 8:20 am

I'm trying to do a query, that will search for any file that begins with any 1 or 2 characters and then the letter.

For instance:

1s
11s
3s
4s
19s

So I have this query:
1s*

What should I swap the 1 with?

Thanks!

void
Site Admin
Posts: 3491
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching for anything that starts with anyletters + s

Postby void » Thu Sep 14, 2017 8:25 am

Search for files that begin with 1 or 2 digits followed by s:
regex:^\d{1,2}s

regex: = enable regular expressions
^ = match start of filename.
\d = match a digit.
{1,2} = match the previous term 1 to 2 times. In this case 1-2 digits.
s = match a single literal s.

Search for files that begin with 1 or 2 characters (any characters) followed by s:
regex:^.{1,2}s

Using wildcards to search for 1 character (any characters) followed by s:
?s*

Using wildcards to search for 2 characters (any characters) followed by s:
??s*

Combining the two:
?s* | ??s*

filipeteles
Posts: 18
Joined: Thu Mar 24, 2016 9:53 am

Re: Searching for anything that starts with anyletters + s

Postby filipeteles » Thu Sep 14, 2017 8:28 am

Thanks, that was quick.

What if I also want it to end with
.wav

void
Site Admin
Posts: 3491
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching for anything that starts with anyletters + s

Postby void » Thu Sep 14, 2017 8:28 am

regex:^\d{1,2}s.*\.wav$

regex: = enable regular expressions
^ = match start of filename.
\d = match a digit.
{1,2} = match the previous term 1 to 2 times. In this case 1-2 digits.
s = match a single literal s.
. = match any character
* = match the previous term zero or more times, in this case match any character zero or more times.
\. = match a single literal .
wav = match the string wav
$ = match the end of the filename.

or, with wildcards, where ? can match any character:
?s*.wav | ??s*.wav

filipeteles
Posts: 18
Joined: Thu Mar 24, 2016 9:53 am

Re: Searching for anything that starts with anyletters + s

Postby filipeteles » Thu Sep 14, 2017 8:32 am

that works


i tried to change it to:
regex:^\d{1,3}s.*\.wav$


but its not querying items with 3 digits

void
Site Admin
Posts: 3491
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching for anything that starts with anyletters + s

Postby void » Thu Sep 14, 2017 8:34 am

Are you sure you have a filename with 3 digits with a s and the .wav extension?

Can you give an example filename that does not match?

filipeteles
Posts: 18
Joined: Thu Mar 24, 2016 9:53 am

Re: Searching for anything that starts with anyletters + s

Postby filipeteles » Thu Sep 14, 2017 8:36 am

my bad, it is querying it
Last edited by filipeteles on Thu Sep 14, 2017 8:39 am, edited 1 time in total.

void
Site Admin
Posts: 3491
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching for anything that starts with anyletters + s

Postby void » Thu Sep 14, 2017 8:38 am

Please make sure Match Path and Match Case are both unchecked from the Search menu.

filipeteles
Posts: 18
Joined: Thu Mar 24, 2016 9:53 am

Re: Searching for anything that starts with anyletters + s

Postby filipeteles » Thu Sep 14, 2017 8:42 am

ok a more complex one


what if i want to find files that before the 1-3 digits + s have the following:

10A -
1A -
2B -
12B -

For instance:

10A - 102s
1B - 1s
12B - 15s


with up to 3 digits before the A or B and up to three digits before the s
is it:

regex:^\d{1,3}A|B" - "d{1,3}s.*\.wav$

void
Site Admin
Posts: 3491
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching for anything that starts with anyletters + s

Postby void » Thu Sep 14, 2017 8:47 am

regex:^\d{1,3}[ab]" - "\d{1,3}s.*\.wav$

[ab] = Match A or B

filipeteles
Posts: 18
Joined: Thu Mar 24, 2016 9:53 am

Re: Searching for anything that starts with anyletters + s

Postby filipeteles » Thu Sep 14, 2017 8:51 am

genius!!!! thanks again mate!


Return to “General”