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.
wildcard
4,641
questions
834
votes
4
answers
688k
views
wildcard * in CSS for classes
I have these divs that I'm styling with .tocolor, but I also need the unique identifier 1,2,3,4 etc. so I'm adding that it as another class tocolor-1.
<div class="tocolor tocolor-1"> tocolor ...
595
votes
18
answers
264k
views
Why is using a wild card with a Java import statement bad?
It is much more convenient and cleaner to use a single statement like
import java.awt.*;
than to import a bunch of individual classes
import java.awt.Panel;
import java.awt.Graphics;
import java....
464
votes
34
answers
491k
views
Select all columns except one in MySQL?
I'm trying to use a select statement to get all of the columns from a certain MySQL table except one. Is there a simple way to do this?
EDIT: There are 53 columns in this table (NOT MY DESIGN)
433
votes
14
answers
623k
views
Get a filtered list of files in a directory
I am trying to get a list of files in a directory using Python, but I do not want a list of ALL the files.
What I essentially want is the ability to do something like the following but using Python ...
402
votes
21
answers
477k
views
Check if a file exists with a wildcard in a shell script [duplicate]
I'm trying to check if a file exists, but with a wildcard. Here is my example:
if [ -f "xorg-x11-fonts*" ]; then
printf "BLAH"
fi
I have also tried it without the double ...
298
votes
17
answers
327k
views
Unzip All Files In A Directory
I have a directory of ZIP files (created on a Windows machine). I can manually unzip them using unzip filename, but how can I unzip all the ZIP files in the current folder via the shell?
Using Ubuntu ...
191
votes
17
answers
318k
views
How to find files that match a wildcard string in Java?
This should be really simple. If I have a String like this:
../Test?/sample*.txt
then what is a generally-accepted way to get a list of files that match this pattern? (e.g. it should match ../Test1/...
181
votes
4
answers
133k
views
What does the double-asterisk (**) wildcard mean?
I've tried the following command but I don't understand the results:
ls **
What does ** mean? How should I use it?
165
votes
4
answers
248k
views
Find all elements on a page whose element ID contains a certain text using jQuery
I'm trying to find all elements on a page whose element ID contains a certain text. I'll then need to filter the found elements based on whether they are hidden or not. Any help is greatly appreciated....
162
votes
9
answers
82k
views
When to use generic methods and when to use wild-card?
I am reading about generic methods from OracleDocGenericMethod. I am pretty confused about the comparison when it says when to use wild-card and when to use generic methods.
Quoting from the document.
...
129
votes
5
answers
182k
views
How to put wildcard entry into /etc/hosts?
I recently wanted to point all subdomains for a test domain, let's say example.com to the localhost. Is there a way to point all requests on *.example.com to resolve to 127.0.0.1
122
votes
4
answers
89k
views
Stop shell wildcard character expansion?
Is there any way for a compiled command-line program to tell bash or csh that it does not want any wildcard characters in its parameters expanded?
For instance, one might want a shell command like:
...
121
votes
7
answers
137k
views
Using % for host when creating a MySQL user
My MySQL database needs two users: appuser and support.
One of the application developers insists that I create four accounts for these users:
appuser@'%'
appuser@'localhost'
support@'%'
support@'...
114
votes
2
answers
52k
views
Why does "_" (underscore) match "-" (hyphen)?
I have to look for a PDF manual using this query:
root@localhost:test> select * from a where name like '%taz_manual%.pdf%';
+--------------------+------------------+-------------+
| name ...
111
votes
5
answers
62k
views
Adding new value to existing Stream
Is there is a good way to add a new value to existing Stream? All I can imagine is something like this:
public <T> Stream<T> addToStream(Stream<T> stream, T elem ) {
List<T>...
111
votes
4
answers
133k
views
How to use a wildcard in the classpath to add multiple jars? [duplicate]
I have been using so many 3rd party libraries(jar files) that my CLASSPATH is completely messed up as i have to include the path for every single jar file that i use.
I've been wondering if there is ...
107
votes
5
answers
45k
views
What expands to all files in current directory recursively?
I know **/*.ext expands to all files in all subdirectories matching *.ext, but what is a similar expansion that includes all such files in the current directory as well?
105
votes
11
answers
163k
views
Matching strings with wildcard
I would like to match strings with a wildcard (*), where the wildcard means "any". For example:
*X = string must end with X
X* = string must start with X
*X* = string must contain X
Also, some ...
100
votes
6
answers
72k
views
rsync not synchronizing .htaccess file
I am trying to rsync directory A of server1 with directory B of server2.
Sitting in the directory A of server1, I ran the following commands.
rsync -av * server2::sharename/B
but the interesting ...
92
votes
7
answers
178k
views
Google Spreadsheet, Count IF contains a string
I have a column like this:
What devices will you be using?
iPad
Kindle & iPad
No Tablet
iPad
iPad & Windows
How do I count the amount of people that said iPad?
This formula does work for ...
89
votes
9
answers
37k
views
Is there a way to use wildcards with git checkout?
What I would like to do is to checkout a single file or a set of files with a common name part like this
git checkout myBranch */myFile.md and
git checkout myBranch -- */*Test* (not sure about the '-...
87
votes
3
answers
44k
views
subprocess wildcard usage
import os
import subprocess
proc = subprocess.Popen(['ls','*.bc'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out,err = proc.communicate()
print out
This script should print all the files ...
85
votes
14
answers
125k
views
How to determine if a List is sorted in Java?
I would like a method that takes a List<T> where T implements Comparable and returns true or false depending on whether the list is sorted or not.
What is the best way to implement this in Java?...
83
votes
5
answers
45k
views
"git add" using wildcard is not functioning as I hoped - must I cd into specific directories?
When I try to do a basic git add *.erb (or any simple wildcard expressions) git is not recognizing it (them). As a side-note, I have never done this before so I'm sure it's a rookie mistake, but I've ...
83
votes
4
answers
62k
views
Wildcard or asterisk (*) vs named or selective import es6 javascript
Just wondering which one is the best way to use import:
import * as Foo from './foo';
VS:
import { bar, bar2, bar3 } from './foo';
In terms of efficiency, say for example, I'm using webpack for ...
81
votes
10
answers
146k
views
Laravel - Using (:any?) wildcard for ALL routes?
I am having a bit of trouble with the routing.
I'm working on a CMS, and I need two primary routes. /admin and /(:any). The admin controller is used for the route /admin, and the view controller ...
79
votes
11
answers
84k
views
List files not matching a pattern?
Here's how one might list all files matching a pattern in bash:
ls *.jar
How to list the complement of a pattern? i.e. all files not matching *.jar?
78
votes
9
answers
109k
views
Is there a wildcard selector for identifiers (id)?
If I have an unknown amount of identifiers sharing a specific naming-scheme, is there a way to grab them all at once using jQuery?
// These are the IDs I'd like to select
#instance1
#instance2
#...
78
votes
6
answers
111k
views
Elasticsearch how to use multi_match with wildcard
I have a User object with properties Name and Surname. I want to search these fields using one query, and I found multi_match in the documentation, but I don't know how to properly use that with a ...
74
votes
1
answer
81k
views
CSS hide all images with matching SRC attribute
Is it possible to create a CSS rule that would apply a style to any IMG tag with a SRC that contained a specific string, say "hideme"? For instance, if I had the following 3 images on a page it would ...
70
votes
4
answers
67k
views
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?
68
votes
11
answers
130k
views
Need to perform Wildcard (*,?, etc) search on a string using Regex
I need to perform Wildcard (*, ?, etc.) search on a string.
This is what I have done:
string input = "Message";
string pattern = "d*";
Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
if (...
68
votes
1
answer
36k
views
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 ...
66
votes
3
answers
10k
views
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) {...
65
votes
8
answers
103k
views
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?
63
votes
5
answers
105k
views
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....
61
votes
5
answers
40k
views
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 ...
59
votes
2
answers
95k
views
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 ...
58
votes
8
answers
28k
views
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 <E> void funct1 (List<E> list1) {
}
function 2:
public static void ...
57
votes
3
answers
45k
views
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 ...
55
votes
7
answers
65k
views
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 ...
54
votes
16
answers
153k
views
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 ...
54
votes
4
answers
29k
views
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 =...
53
votes
2
answers
160k
views
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
49
votes
3
answers
50k
views
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 ...
48
votes
3
answers
57k
views
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?
48
votes
18
answers
151k
views
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("...
47
votes
2
answers
70k
views
Java generics "capture of ?"
I'm working with a TreeTable and when changing cell factory I am required to pass a
Callback<TreeTableColumn<A, capture of ?>, TreeTableCell<A, capture of ?>>
where A is a class I ...
46
votes
2
answers
38k
views
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....
45
votes
14
answers
72k
views
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?
...