Does [_ \ s ^ "] mean underscore and space, but not" (quote) in Regex?

Does [_ \ s ^ "] mean underscore and space, but not" (quote) in Reg

I understand that brackets ([]) mean a range of characters and what ^ means but not, but my question is, can you say [this ^ notthat] or do I need to separate them into two sets of brackets?

+3
source share
4 answers

^is only special at the beginning of the character class. You can even write [^^]to say no carriages.

" , "", , , ". , - " , Q". : [A-PR-Z].

+8

, , . , , .

: [this ^ notthat] ?

. [this][^that] , , "a t, h, i s, , t, h a"

+1

, ^ , . : [abc^] "^" , - " -": [\w-] "abc-def"

0

, ^ , .

A construct such as [ABC^DEF]for expressing A, B or C, but not DEF, does not make sense. If it is A, B or C, it cannot be D, E or F, so part of the expression is redundant. If you have characters that exist in both blocks, you can simplify it: [this^notthat] => [is]by deleting any character in the "this" part, which also exists in this part.

If you work with large sequences, things can be a little more confusing.

0
source

Source: https://habr.com/ru/post/1739736/


All Articles