Say I have a function
print_args () {
for i in $@; do
echo "$i"
done
}
When I do
foo='\*'
print_args $foo
I get
\*
(with the backslash) as output.
If I change the definition of foo to foo='*' instead, I get all the files in the…
This question relates to R but really isn't language specific per se. I have a bunch of csv files with this general format "sitename_03082015.csv". The files have 5 columns and various rows
Host MaximumIn MaximumOut AverageIn …
In a certain ID field we are indexing on a document looks like this:
1234 45676
We want to be able to do fulltext searches on each of the 2 groups of numbers, just as if they are strings. I escape the number groups in quotes, which the mongo…
I have several bash scripts which read arbitrary strings (usually from stdin). When those strings contain things that bash recognizes, then things break.
For example, I have a simple logging script (named al) whose main function is to take an input…
Here is the line of text:
003 STATE BANK OF BIK & JAI A/C.1 2 1,01,500.00 1 3,160.00 98,340.00+
Here is my code snippet to split it:
Pattern pat = Pattern.compile("[ ]");
String strs[] =…
I'm having problems while replacing metacharacters using regular expressions.
The phrase I want the regular expressions replace the metacharacter is:
ley+sobre+propiedad+literaria+1847
And the code I use is that below:
$file =~ s/\+/\s/; # -->…
I have a bash script in which I am running a MySQL statement:
#!/usr/bin/env bash
mysql -N --user=foo --password=bar --host=baz -A -D db -e '\
SELECT ... \
FROM fieldA, fieldB \
LIMIT 100'
This works fine. However, instead of the…
I ran across the following in Gentoo Linux's wiki about dynamic jumphost list:
ProxyCommand ssh $(echo %h | sed 's/+[^+]*$//;s/\([^+%%]*\)%%\([^+]*\)$/\2 -l \1/;s/:/ -p /') nc -w1 $(echo %h | sed 's/^.*+//;/:/!s/$/ %p/;s/:/ /')
It works, but I…
I have str1 and str2 below, and I want to use just one regexp which will match both. In case of str1, I also want to be able to capture the number of QSFP ports
>>> str1='''4 48 48-port and 6 QSFP 10GigE Linecard 7548S-LC'''
>>> str2='''4 48…
I have a list of patterns I want to look for in a string. These patterns are numerous and contain numerous metacharacters that I want to just match literally. So this is the perfect application for metaquoting with \Q..\E. The complication is that I…
I encounter a problem like this. I successfully create a pattern containing a word that is built from word-character only (no number, special character). It looks like this ^[^\d\W]*[^\d\W]*[^\d\W]$ but it works for 1 word only as below:
# "abcd"…
I am receiving the values of text fields from the front end and performing sql operation on the values. I am using "insert_format.format" to format the fields. But this does not work when meta characters are sent from the UI.
Below is my python…
I try to have a regex validating an input field.
What i call "joker" chars are '?' and '*'.
Here is my java regex :
"^$|[^\\*\\s]{2,}|[^\\*\\s]{2,}[\\*\\?]|[^\\*\\s]{2,}[\\?]{1,}[^\\s\\*]*[\\*]{0,1}"
What I'm tying to match is :
Minimum 2…