Questions tagged [metacharacters]

metacharacters are non-alphanumeric characters which are part of the processing model of a program rather than the literal value of a string

References

84 questions
1
vote
1 answer

Store literal wildcard character in bash string

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…
Chris Middleton
  • 5,654
  • 5
  • 31
  • 68
1
vote
2 answers

Regex and file processing

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 …
JohnP
  • 65
  • 1
  • 6
1
vote
1 answer

How can we treat groups of digits as strings in mongodb fulltext searches?

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…
Ben Weaver
  • 960
  • 1
  • 8
  • 18
1
vote
1 answer

jQuery selectors with meta-characters

I'm having problem selecting an element with an id like this
  • . I tried using the function that escapes meta-characters with two backslashes below from this jquery link but still can't select the…
  • steamboy
    • 1,162
    • 5
    • 20
    • 37
    1
    vote
    1 answer

    Read (from stdin or a file) an arbitrary string into bash and use it without any shell expansions

    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…
    Joe
    • 351
    • 2
    • 16
    1
    vote
    1 answer

    splitting text using Pattern.compile

    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[] =…
    1
    vote
    3 answers

    Perl -- replacing metacharcters with regular expressions

    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/; # -->…
    Marc Ortiz
    • 2,242
    • 5
    • 27
    • 46
    1
    vote
    1 answer

    Command-line MySQL select with different field terminator

    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…
    Alex Reynolds
    • 95,983
    • 54
    • 240
    • 345
    1
    vote
    1 answer

    Why using double backslashes in sed for running ssh?

    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…
    user183394
    • 1,033
    • 1
    • 11
    • 20
    1
    vote
    4 answers

    How to capture strings using * or ? with groups in python regular expressions

    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…
    Sanjay BM
    • 11
    • 2
    1
    vote
    1 answer

    Metaquoting patterns in a variable list

    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…
    MattLBeck
    • 5,701
    • 7
    • 40
    • 56
    0
    votes
    0 answers

    How to "extend" regex pattern from a word to whole sentence?

    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"…
    user18344984
    0
    votes
    1 answer

    How to handle meta characters in insert_format.format?

    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…
    0
    votes
    1 answer

    Metacharacters python extracting dates

    I want to extract dates in the format Month Date Year. For example: 14 January, 2005 or Feb 29 1982 the code im using: date = re.findall(r'\d{1,3}…
    0
    votes
    3 answers

    Java Regex with "Joker" characters

    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…
    Matt Zdj
    • 59
    • 8