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

How can I get a long listing of text files containing "foo" followed by two digits?

Using metacharacters, I need to perform a long listing of all files whose name contains the string foo followed by two digits, then followed by .txt. foo**.txt will not work, obviously. I can't figure out how to do it.
user2504710
  • 42
  • 1
  • 8
0
votes
1 answer

regular expressions metacharacters screening

To find substring I use regEx pattern = "^value\s\w+\s\d+$", where value sometimes contains metacharacters. I just need to know if it is possible to make metacharacters from value not to be interpret as metacharacters?
Bor1ss
  • 39
  • 7
0
votes
0 answers

JQuery selector with meta-character using literals

I know there are a lot of threads about using meta-character in jQuery selector, but I promise this is unique. I've an html div element with meta-character in its id. Like below,

Click ME

Kay
  • 393
  • 4
  • 15
0
votes
2 answers

Sub-pattern in regex can't be dereferenced?

I have following Perl script to extract numbers from a log. It seems that the non-capturing group with ?: isn't working when I define the sub-pattern in a variable. It's only working when I leave out the grouping in either the regex-pattern or the…
EverythingRightPlace
  • 1,197
  • 12
  • 33
0
votes
3 answers

confusion in Meta characters of perl

When I run the below program, it gave me nothing ("") as result. Scenario 1:- $var = "A STITCH IN TIME SAVES NINE"; if ($var =~ /[1..9]/i) { print "FOUND\n" } But when I add space before and after '..' operator, it threw "…
Praveen kumar
  • 597
  • 2
  • 14
  • 26
0
votes
1 answer

How to match a String having metacharacters using regex matches function in Java

What could be the regular expression to match below String String str = "\r\n regular"; There is a carriage return "\r", new line character "\n" and a space after . My code is as…
Suvasis
  • 1,451
  • 4
  • 24
  • 42
0
votes
1 answer

Replace Strings in java having metacharacters

I have two strings and want to replace one string from the other. The problem is that strings have meta characters. E.g. String string1 = "I am foo"; String string2 = "I am bar and I am foo. I am both."; string2 = string2.replaceAll(string1, "");…
user2200660
  • 1,261
  • 3
  • 18
  • 23
0
votes
2 answers

Regex in Java: a*

Do you know why in a simple regex pattern if put a*(quantifier) it does not match any result in the matcher even though it actually contains the character a; (in any case it should give back a result of having found an empty string as I am using…
Rollerball
  • 12,618
  • 23
  • 92
  • 161
-1
votes
2 answers

Perl, pattern matching and metacharacters

I am trying to match two things which both are full of metacharacters that needs to be used as 'Literal' in my match pattern. \Q is suppose to quote all metacharacter in a string until \E...but it doesn't work. Whats up with that? this is the line…
-1
votes
1 answer

awk ignore the field delimiter pipe inside double quotes

I know this question is already answered but with comma as a separator. How to make awk ignore the field delimiter inside double quotes? But My file is separated by pipe, when I use this in regex it act as a regex only and not getting proper output.…
Kalpesh
  • 694
  • 2
  • 8
  • 28
-1
votes
2 answers

Filter using string with any possible content in BigQuery

I am a newbie using BigQuery. I am building a query that I will share with several other people. Each person is responsible for different business units and I want them to be able to easily insert the name of their business units in this query. I…
Rafael Pinheiro
  • 393
  • 4
  • 16
-1
votes
1 answer

Matching string that contain Metacharacters with re.findall() and re.escape()?

What is the regular expression for matching a sentence that contains metacharacters ? Following the senario : I have a string : line = "He finally answer (after taking time to think (5 minutes) * sighs ; end)" I want to match this part of the…
Julia
  • 11
  • 2
-1
votes
1 answer

Escaping meta characters in PHP

I was surprised to discover that the MySQL query SELECT * WHERE name LIKE "%AFA_"; returns rows where name is SAFARI. To get it to match on the underscore, you have to do: SELECT * WHERE name LIKE "%AFA\_"; Is there a PHP function that can do…
Scott C Wilson
  • 19,102
  • 10
  • 61
  • 83
-1
votes
1 answer

String contains any but one character

I want to check if a String contains a } with any character in front of it except \. As far as I know I can use . as a metacharacter in aString.contains(...) to allow any character at that position but I don’t know how to create something like a…
LeWimbes
  • 517
  • 1
  • 10
  • 25
-1
votes
1 answer

Perl: quoting correctly all special characters

I have this sample string, containing 2 backslashes. Please don't ask me for the source of the string, it is just a sample string. my $string = "use Ppppp\\Ppppp;"; print $string; Both, double quotes or quotes will print use Ppppp\Ppppp; Using my…
Claude
  • 171
  • 10