MemoryRefresh!

Egrep / Negated character classes     Negated character classes



Questions 1 Answers 0%

Pages   0 from 15
Questions   0 from 20

Reset


Negated character class
If you use [^..] instead of [..], the class matches any character that isn't listed. For example [^1-6] matches a character that's not 1 through 6.
Not the same as start
The ^ used here is the same as start-of-line caret, but the meaning is completely different.
Example
q[^u] matches Iraqi, Iraqian q[^u] doesn't match Qantas, because it called for a lower case q q[^u] doesn't match Iraq, because q is at the end (newline character is not ^u)
Meaning
Regex [^x] doesn't mean "match unless there is an x", but rather "match if there is something that is not x"
1) [^1-6] matches





2) does q[^u] matches Iraq?







Negated character class
If you use [^..] instead of [..], the class matches any character that isn't listed. For example [^1-6] matches a character that's not 1 through 6.
Not the same as start
The ^ used here is the same as start-of-line caret, but the meaning is completely different.
Example
q[^u] matches Iraqi, Iraqian q[^u] doesn't match Qantas, because it called for a lower case q q[^u] doesn't match Iraq, because q is at the end (newline character is not ^u)
Meaning
Regex [^x] doesn't mean "match unless there is an x", but rather "match if there is something that is not x"

References









Programming

Php
   
Regex
   
MySQL
   
Css
   
jQuery
   
Git
   


References