please can any one help me to break this code and explain it to me
this code as shown in the title
i know the output of it but i want to know how it works
REGEX : (?<!\\w)[tT]\\w+”)
please can any one help me to break this code and explain it to me
this code as shown in the title
i know the output of it but i want to know how it works
REGEX : (?<!\\w)[tT]\\w+”)
The parts of the regex are:
(?<!\\w) = "the preceding char is not a "word" char[tT] = either "t" or "T"\\w+ = "one or more "word" charsOver all, it means "a word that starts with T and is at least 2 chars long"
Incidentally, this can be expressed more succinctly as:
\b[tT]\\w+
\b meaning "word boundary"
(?<!\\w)[tT]\\w+
(?<!\\w)==>negative lookbehind (there should not be a [a-zA-Z0-9_] behind t or T.
[tT]======>t or T.
\\w+======>any [a-zA-Z0-9_]+.(should be one or more)
Basically it captures words like
train,Train,@train,train,to,t121ka etc.
It will not capture
atrain