character-class Questions

6

Solved

Given a class, such as [:digit:] I would like the output to be 0123456789 Note, the method should work for all POSIX character classes. Here is what I have tried $ printf %s '[:digit:]' [:di...
Tasset asked 23/10, 2014 at 18:21

3

Solved

What character class or Unicode property will match any Unicode vowel in Perl? Wrong answer: [aeiouAEIOU]. (sermon here, item #24 in the laundry list) perluniprops mentions vowels only for Hangul...
Average asked 5/8, 2016 at 15:24

4

Solved

I'm having trouble getting sed to recognize both hyphen and underscore in its pattern string. Does anyone know why [a-z|A-Z|0-9|\-|_] in the following example works like [a-z|A-Z|0-9|_] ? ...
Empanel asked 12/3, 2017 at 5:1

1

Solved

What I am trying to do is to allow programs to define character class depending on text encountered. However, <[]> takes characters literally, and the following yields an error: my $all1Line = ...
Jamarjamb asked 25/10, 2019 at 17:24

2

If I type /[\w-+]/ in the Chrome console, it accepts it. I get a regex object I can use to test strings as usual. But if I type /[\w-+]/u, it says VM112:1 Uncaught SyntaxError: Invalid regular expr...
Spurge asked 15/1, 2019 at 18:55

8

Solved

yo, so im trying to make a program that can take string input from the user for instance: "ONCE UPON a time" and then report back how many upper and lowercase letters the string contains: output ...
Mutilate asked 10/8, 2014 at 2:25

2

Solved

from what i researched, the expression "[:alpha:]" will be matched for any alphabetic character, but the expression only match for lowercase character and not uppercase character. I not sure ...
Austronesian asked 9/6, 2018 at 10:24

4

Solved

I recently came across a puzzle to find a regular expression that matches: 5-character-long strings comprised of lowercase English letters in ascending ASCII order Valid examples include: aaa...
Halloo asked 30/6, 2017 at 14:33

3

Solved

When we include shorthand for character class and negated-character class in same character class, is it same as dot . which mean any character ? I did a test on regex101.com and every character ...
Rowney asked 29/5, 2017 at 15:40

1

Solved

I am trying to replace all punctuation except the - and _ using a method I found here, but I can only get it to work on " using the exact code as posted which used a negative lookahead: (?!")\\p{p...
Wrongdoer asked 26/10, 2016 at 15:47

5

Is there a simple way to match all characters in a class except a certain set of them? For example if in a lanaguage where I can use \w to match the set of all unicode word characters, is there a w...
Limoges asked 26/6, 2013 at 18:28

5

Solved

Why can't I match the string "1234567-1234567890" with the given regular expression \d{7}-\d{10} with egrep from the shell like this: egrep \d{7}-\d{10} file ?
Marquise asked 6/7, 2010 at 10:36

1

Solved

Simply put: echo "xxxxx Tyyy zzzzz" | egrep "\byyy\b" (no match which is correct) echo "xxxxx T-yyy zzzzz" | egrep "\byyy\b" xxxxx T-yyy zzzzz I dont want it to match like it does in the se...
Somnus asked 3/9, 2015 at 15:56

1

Solved

How can I search for, say, a sequence of 10 isprint characters in a given string in Python? With GNU grep, I would simply do grep [[:print:]]{10}
Dues asked 10/8, 2015 at 8:53

1

Solved

Perl (< v5.18) regular expression character class \s for whitespace is the same as [\t\n\f\r ]. Now, since some filenames use underscore as spaces, I was wondering if it's possible to redefine ...
Nmr asked 13/7, 2015 at 23:56

2

It seems that using a character class is faster than the alternation in an example like: [abc] vs (a|b|c) I have heard about it being recommended and with a simple test using Time::HiRes I verified...

2

For example, I set up these: L = /[a-z,A-Z,ßäüöÄÖÜ]/ V = /[äöüÄÖÜaeiouAEIOU]/ K = /[ßb-zBZ&&[^#{V}]]/ So that /(#{K}#{V}{2})/ matches "ßäÜ" in "azAZßäÜ". Are there any better ways of de...
Marlowe asked 19/4, 2013 at 9:39

5

Solved

...when used in patterns like "\\p{someCharacterClass}". I've used/seen some: Lower Upper InCombiningDiacriticalMarks ASCII What is the definitive list of all supported built-in character class...
Thanet asked 27/12, 2011 at 23:20

1

Solved

In Perl regexes, expressions like \1, \2, etc. are usually interpreted as "backreferences" to previously captured groups, but not so when the \1, \2, etc. appear within a character class. In the la...
Leucocytosis asked 14/8, 2013 at 20:54

2

Solved

I am new to regular expressions and have been given the following regular expression: (\p{L}|\p{N}|_|-|\.)* I know what * means and | means "or" and that \ escapes. But what I don't know what ...
Loveridge asked 15/2, 2013 at 9:1

1

Solved

Using Ruby 1.9.2, I have the following Ruby code in IRB: > r1 = /^(?=.*[\d])(?=.*[\W]).{8,20}$/i > r2 = /^(?=.*\d)(?=.*\W).{8,20}$/i > a = ["password", "1password", "password1", "pass1wor...
Globeflower asked 26/11, 2012 at 21:4

2

Solved

Strangely I can't seem to find anywhere a list of the characters that I can't safely use as literals within MySQL regular expression square brackets without escaping them or requiring the use of a ...
Nix asked 15/11, 2011 at 18:27

1

Solved

Given I have the following string: This is a test {{ string.string.string }}. And try to perform the following substitution: %s/{{ [\w\.]\+ }}/substitute/g It will not work with the error: Pa...
Matteson asked 27/7, 2011 at 13:51

3

Solved

There are many questions and answers here on StackOverflow that assume a "letter" can be matched in a regexp by [a-zA-Z]. However with Unicode there are many more characters that most people would ...

2

Solved

How do you replace all of the characters in a string that do not fit a criteria. I'm having trouble specifically with the NOT operator. Specifically, I'm trying to remove all characters that are ...
Gasparo asked 2/10, 2010 at 19:54

© 2022 - 2024 — McMap. All rights reserved.