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

R Regex: Parenthesis Not Acting as Metacharacter

I am trying to split a string by the group "%in%" and the character "@". All documentation and everything I can find says that parenthesis are metacharacters used for grouping in R regex. So the code > strsplit('example%in%aa(bbb)aa@cdef',…
esa606
  • 370
  • 3
  • 13
2
votes
1 answer

What are dangling metacharacters in regex?

In Ruby, I wrote a simple regex to find the first {: txt.gsub! /^.*{/, '{' Whenever I run this, everything past that point for my purposes works fine, however there is a mild error that reads along the lines of WARNING: Dangling metacharacter…
T145
  • 1,415
  • 1
  • 13
  • 33
2
votes
1 answer

pexpect and shell meta characters (>, |, or *)

I am pretty confused right now. pexpect documentation states the following: Remember that Pexpect does NOT interpret shell meta characters such as redirect, pipe, or wild cards (>, |, or *). This is a common mistake. If you want to run a command and…
theAlse
  • 5,577
  • 11
  • 68
  • 110
2
votes
3 answers

What does grep ^- mean in UNIX?

As title says, what does grep ^- mean in UNIX? I know what grep is but not the metacharater ^- part.
Sunny
  • 21
  • 1
  • 4
1
vote
1 answer

What does `$*`(a dollar sign followed by a star) mean in the default setting of `grepprg` in vim?

In a vanilla vim on Mac, when I type :set grepprg?, it returns the following: grepprg=grep -n $* /dev/null. I understand what -n and /dev/null means, thanks to an old question here. I also understand what $ and * means individually. However, I am…
chunyun
  • 83
  • 6
1
vote
2 answers

What is the purpose of dot (.) in filename before extension. Is it some sort of operator?

filename.txt string.h Consider above filenames, is there any specific meaning of using dot (.) in any file name. we use it everywhere, in every file.
1
vote
1 answer

"Safe way" to use java matcher.replaceAll() / appendReplacement()

Most of the cases we replace string segments using regular expression, when the replacement text is a variable, so basically it is not known by the programmer. However we always forget, that the behavior of java matcher.replaceAll() will very much…
1
vote
1 answer

R - regex: W metacharacter not working when within square brackets

Let's take the following string: x <- " hello world" I would like to extract the first word. To do so, I am using the following regex ^\\W*([a-zA-Z]+).* with a back-reference to the first group. > gsub("^\\W*([a-zA-Z]+).*", "\\1", x) [1]…
Junitar
  • 905
  • 6
  • 13
1
vote
3 answers

Replace multiple strings comprising of a different number of characters with one gsubfn()

Here Replace multiple strings in one gsub() or chartr() statement in R? it is explained to replace multiple strings of one character at in one statement with gsubfn(). E.g.: x <- "doremi g-k" gsubfn(".", list("-" = "_", " " = ""), x) #…
koteletje
  • 625
  • 6
  • 19
1
vote
1 answer

bash metachars in pattern substitution

I usually use the bash pattern substitution ${parameter/pattern/string} and I wonder if there are any substitution string metcharacters like & in other tools (for instance sed, awk). I'm trying to use the bash pattern substitution to insert 0x just…
Jdamian
  • 3,015
  • 2
  • 17
  • 22
1
vote
2 answers

php spltting string to an array with metachars

I want to split a string in to array. I want that the words and the metacharacters separated in an array. Like this: $string = 'This is a string? Or an array?'; i want: array[0] = 'This', array[1] = 'is', array[2] = 'a', array[3] =…
Overste
  • 111
  • 2
  • 4
1
vote
0 answers

XSD Character Class Negate with group

In my xsd I'm using negate to check for disallowed characters. This is within a restriction pattern tag: ^[^ab]+$ This will allow any string unless it contains either a or b. My requirement is that the string can contain anything but a or b or cd …
mattgoss
  • 31
  • 2
1
vote
2 answers

Java Regex Metacharacters returning extra space while spliting

I want to split string using regex instead of StringTokenizer. I am using String.split(regex); Regex contains meta characters and when i am using \[ it is returning extra space in returning array. import java.util.Scanner; public class Solution{ …
Linkon
  • 81
  • 10
1
vote
3 answers

Replace tabs ("\t") in flat file with "Unit Separator" (0x1f) in C#

I have been having trouble finding the metacharacter for the 'Unit Separator' to replace the tabs in a flat file. So far I have this: File.WriteAllLines(outputFile, File.ReadLines(inputFile) .Select(t => t.Replace("\t", "\0x1f"))); //this…
J.S. Orris
  • 4,653
  • 12
  • 49
  • 89
1
vote
2 answers

text mining with tm package in R ,remove words starting from [http] or any other specifc word

I am new to R and text mining. I had made a word cloud out of twitter feed related to some term. The problem that I'm facing is that in the wordcloud it shows http:... or htt... How do I deal about this issue I tried using metacharacter * but I…