Questions tagged [wildcard]

A wildcard character is a specially defined character allowing for substitution of any other character, including a pattern or sequence of characters. Use this tag for questions on how to use wildcards for regular expressions, shell scripting, string manipulation and database control, but not for use in terminal commands as that is off-topic.

A wildcard character is a special character defined by many different systems/programming languages with each their own specific implementations. They may allow for accessing single characters, sets of characters or all characters matching a certain regex pattern.

Examples include :

* - Any sequence of characters. (DOS/Unix)
? - Any single character. (DOS/Unix)
% - Zero or more characters. (SQL)
# - Matches a single numeral. (SQL)
. - Matches a single character. (Regular Expressions)

4611 questions
47
votes
3 answers

How do I search for a list of files using wildcard

How do I use wildcards in C# to list down files contained in a selected folder?
yeeen
  • 4,911
  • 11
  • 52
  • 73
46
votes
2 answers

Java generics "capture of ?"

I'm working with a TreeTable and when changing cell factory I am required to pass a Callback, TreeTableCell> where A is a class I am working with but I have no idea how to work with the "capture of…
kotycheese
  • 485
  • 1
  • 4
  • 6
44
votes
2 answers

How do I pass a wildcard parameter to a bash file

I'm trying to write a bash script that allows the user to pass a directory path using wildcards. For example, bash show_files.sh * when executed within this directory drw-r--r-- 2 root root 4.0K Sep 18 11:33 dir_a -rw-r--r-- 1 root root 223…
eisaacson
  • 758
  • 2
  • 7
  • 21
43
votes
3 answers

Sum all columns with a wildcard name search using Python Pandas

I have a dataframe in python pandas with several columns taken from a CSV file. For instance, data =: Day P1S1 P1S2 P1S3 P2S1 P2S2 P2S3 1 1 2 2 3 1 2 2 2 2 3 5 4 2 And what I need is to get the sum of all columns…
jbssm
  • 6,861
  • 13
  • 54
  • 81
43
votes
14 answers

Wildcard search for LINQ

I would like to know if it is possible to do a wildcard search using LINQ. I see LINQ has Contains, StartsWith, EndsWith, etc. What if I want something like %Test if%it work%, how do I do it? Regards
PlayKid
  • 1,345
  • 5
  • 20
  • 33
42
votes
6 answers

Pattern matching using a wildcard

How do I identify a string using a wildcard? I've found glob2rx, but I don't quite understand how to use it. I tried using the following code to pick the rows of the data frame that begin with the word blue: # make data frame a <- data.frame( x = …
djq
  • 14,810
  • 45
  • 122
  • 157
42
votes
6 answers

When to use wildcards in Java Generics?

this is from HeadFirst Java: ( page 575 ) This: public void takeThing(ArrayList list) Does the same thing as this: public void takeThing(ArrayList list) So here is my question: if they are exactly same, why…
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
42
votes
3 answers

Wildcard to obtain list of all directories

In my Makefile I need to get a list of all directories present in some other directory. To get a list of all directories in the same folder as my Makefile I use: DIRECTORIES = $(wildcard */) all: echo $(DIRECTORIES) which works fine, and gives…
Haatschii
  • 9,021
  • 10
  • 58
  • 95
40
votes
3 answers

MongoDB wildcard in the key of a query

Is it possible to wildcard the key in a query? For instance, given the following record, I'd like to do a .find({'a.*': 4}) This was discussed here https://jira.mongodb.org/browse/SERVER-267 but it looks like it's not been resolved. { 'a': { …
Brad
  • 735
  • 1
  • 8
  • 15
40
votes
5 answers

Open file by filename wildcard

I have a directory of text files that all have the extension .txt. My goal is to print the contents of the text file. I wish to be able use the wildcard *.txt to specify the file name I wish to open (I'm thinking along the lines of something like…
greg
  • 401
  • 1
  • 4
  • 4
38
votes
5 answers

Can I use shell wildcards to select filenames ranging across double-digit numbers (e.g., from foo_1.jpg to foo_54.jpg)?

I have a directory with image files foo_0.jpg to foo_99.jpg. I would like to copy files foo_0.jpg through foo_54.jpg. Is this possible just using bash wildcards? I am thinking something like cp foo_[0-54].jpg but I know this selects 0-5 and 4…
DQdlM
  • 9,814
  • 13
  • 37
  • 34