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
66
votes
3 answers

Multiple wildcards on a generic methods makes Java compiler (and me!) very confused

Let's first consider a simple scenario (see complete source on ideone.com): import java.util.*; public class TwoListsOfUnknowns { static void doNothing(List list1, List list2) { } public static void main(String[] args) { …
polygenelubricants
  • 376,812
  • 128
  • 561
  • 623
64
votes
8 answers

Use wildcard with os.path.isfile()

I'd like to check if there are any .rar files in a directory. It doesn’t need to be recursive. Using wildcard with os.path.isfile() was my best guess, but it doesn't work. What can I do then?
Alex
  • 823
  • 2
  • 7
  • 6
64
votes
4 answers

SSL Multilevel Subdomain Wildcard

I bought a wildcard certificate for *.example.com. Now, I have to secure *.subdomain.example.com. Is it possible to create a sub-certificate for my wildcard-certificate? If it is, how I can do this?
Attrachii
  • 673
  • 1
  • 5
  • 4
64
votes
1 answer

Makefile rule that depends on all files under a directory (including within subdirectories)

One rule in my Makefile zips an entire directory (res/) into a ZIP file. Obviously, this rule needs to execute when any file under the res/ directory changes. Thus, I want the rule to have as a prerequisite all files underneath that directory. How…
Mechanical snail
  • 29,755
  • 14
  • 88
  • 113
61
votes
5 answers

PHP file_exists and wildcard

Is there a way to write the PHP file_exists function so that it searches a directory for a file with an arbitrary extension. For instance, suppose I knew that a file were called "hello", but I didn't know the extension, how would I write a function…
bsamek
  • 1,773
  • 3
  • 17
  • 23
59
votes
5 answers

Search for a file using a wildcard

I want get a list of filenames with a search pattern with a wildcard. Like: getFilenames.py c:\PathToFolder\* getFilenames.py c:\PathToFolder\FileType*.txt getFilenames.py c:\PathToFolder\FileTypeA.txt How can I do this?
Stan
  • 37,207
  • 50
  • 124
  • 185
58
votes
8 answers

Difference between generic type and wildcard type

I'm a newbie in Generic and my question is: what difference between two functions: function 1: public static void funct1 (List list1) { } function 2: public static void funct2(List list) { }
Fio
  • 651
  • 1
  • 8
  • 8
57
votes
2 answers

Wildcard subdomains with dnsmasq

I have a device that is already mapped to domain.tld. I now want to create a wildcard for all subdomains *.domain.tld so that they are mapped to the ip of domain.tld, too. How do I do this with dnsmasq?
danb
  • 573
  • 1
  • 4
  • 5
55
votes
3 answers

How to escape underscores in Postgresql

When searching for underscores in Postgresql, literal use of the character _ doesn't work. For example, if you wanted to search all your tables for any columns that ended in _by, for something like change log or activity information, e.g.…
Joe M
  • 3,060
  • 3
  • 40
  • 63
55
votes
7 answers

mongoDB prefix wildcard: fulltext-search ($text) find part with search-string

I have mongodb with a $text-Index and elements like this: { foo: "my super cool item" } { foo: "your not so cool item" } If i do search with mycoll.find({ $text: { $search: "super"} }) i get the first item (correct). But i also want to…
mdunisch
  • 3,627
  • 5
  • 25
  • 41
53
votes
4 answers

SQL LIKE with no wildcards the same as '='?

I know this is a pretty basic question, and I think I know the answer...but I'd like to confirm. Are these queries truly equivalent? SELECT * FROM FOO WHERE BAR LIKE 'X' SELECT * FROM FOO WHERE BAR ='X' Perhaps there is a performance overhead in…
javamonkey79
  • 17,443
  • 36
  • 114
  • 172
51
votes
2 answers

Using SED with wildcard

I want to replace a string with wildcard but it doesn't work. The string looks like "some-string-8" I wrote sed -i 's/string-*/string-0/g' file.txt but the output is some-string-08
mahmood
  • 23,197
  • 49
  • 147
  • 242
51
votes
16 answers

SQL Server using wildcard within IN

Since I believe this should be a basic question I know this question has probably been asked, but I am unable to find it. I'm probably about to earn my Peer Pressure badge, but I'll ask anyway: Is there a way in SQL Server that I am not aware of for…
Dusty
  • 4,667
  • 3
  • 29
  • 35
48
votes
3 answers

Is it possible to use find and replace on a wildcard string in VIM?

For example, I have a bunch of values with a common prefix and postfix, such as: fooVal1Bar; fooVal2Bar; fooVal3Bar; In this case, all variable names begin and end with foo and end with Bar. I want to use a find and replace using the random…
dwcanillas
  • 3,562
  • 2
  • 24
  • 33
47
votes
18 answers

How to implement a SQL like 'LIKE' operator in java?

I need a comparator in java which has the same semantics as the sql 'like' operator. For example: myComparator.like("digital","%ital%"); myComparator.like("digital","%gi?a%"); myComparator.like("digital","digi%"); should evaluate to true,…
Chris
  • 15,429
  • 19
  • 72
  • 74