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
104
votes
5 answers

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?
Ramon
  • 8,202
  • 4
  • 33
  • 41
103
votes
11 answers

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 compound uses such as: *X*YZ* = string contains X and…
Robinson
  • 9,666
  • 16
  • 71
  • 115
100
votes
6 answers

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 thing is, it synchronizes all files and directories…
Sangfroid
  • 1,323
  • 3
  • 9
  • 5
91
votes
7 answers

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 exact matches but not if it contains an additional value:…
Cody
  • 919
  • 1
  • 6
  • 3
86
votes
9 answers

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 '--' part) instead of git checkout myBranch…
kostja
  • 60,521
  • 48
  • 179
  • 224
85
votes
14 answers

How to determine if a List is sorted in Java?

I would like a method that takes a List 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? It's obvious that generics and wildcards are meant to…
Eric Wilson
  • 57,719
  • 77
  • 200
  • 270
84
votes
3 answers

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 with .bc suffix however it returns an empty list.…
Cemre Mengü
  • 18,062
  • 27
  • 111
  • 169
79
votes
4 answers

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 bundling all the JavaScript files. Will the first one…
andiwin
  • 1,552
  • 3
  • 14
  • 27
79
votes
10 answers

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 should be used for anything else than /admin. From the…
qwerty
  • 5,166
  • 17
  • 56
  • 77
79
votes
5 answers

"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 found no help in other SO posts or my school's…
RudyOnRails
  • 1,819
  • 3
  • 17
  • 26
78
votes
11 answers

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?
calebds
  • 25,670
  • 9
  • 46
  • 74
78
votes
9 answers

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 #instance3 #instance4 // What do I need to add or how…
Matt Elhotiby
  • 43,028
  • 85
  • 218
  • 321
75
votes
6 answers

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 wildcard. Is it possible? I tried with a…
74
votes
1 answer

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 hide the second one?
user736893
66
votes
11 answers

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 (regex.IsMatch(input)) { …
Scott
  • 669
  • 1
  • 5
  • 3