Help command $regex - 19/11/14 09:01 PM
I saw the wiki but have a single example:
But that example, I can not understand in this code:
The line:
a)Why \Q ?
b) Why it that signifcan this: \E(\w+)$/)
c) What is the use of /g in the example above of wiki?
Please explain this whole line as simply and clearly, note that not mastered the English language.
Thank you.
Quote:
$regex(a cat walked by the dog,/cat|dog/g)
;'cat' and 'dog' are matched, returns 2
;'cat' and 'dog' are matched, returns 2
But that example, I can not understand in this code:
Code:
alias YouTube { if ($regex($1-, /\Qyoutube.com/watch?v=\E(\w+)$/)) { sockclose YouTube sockopen YouTube www.youtube.com 80 ; keep the video ID for later on sockmark YouTube $regml(1) echo -a The video ID is: $regml(1) } else { echo $color(info) -aef /YouTube: invalid youtube link halt } }
The line:
Code:
if ($regex($1-, /\Qyoutube.com/watch?v=\E(\w+)$/)) {
a)Why \Q ?
b) Why it that signifcan this: \E(\w+)$/)
c) What is the use of /g in the example above of wiki?
Please explain this whole line as simply and clearly, note that not mastered the English language.
Thank you.