Why should you return ["vddv"] instead of ["dd"]:
["vddv"]
"aaavddv".match(/(?:v).*(?:v)/)
(?:v) # matches 'v' this is a non-capturing group, not a lookbehind .* # matches 'dd' (?:v) # matches 'v' this is a non-capturing group, not a lookahead
Groups that are not participating in the capture are still participating in this match. Maybe you need a look? But Javascript does not support lookbehind.
"aaavddv".match(/(?:v)(.*)(?:v)/)[1]
the whole match is correct vddv , but if you want to combine only dd , you need to use the capture group (and look at element [1] )
vddv
dd
[1]
/(?:v).*(?:v)/ indicates the expression v (number of characters) v
/(?:v).*(?:v)/
Source: https://habr.com/ru/post/1413941/More articles:How to determine class inheritance using Puppet Ruby DSL - ruby | fooobar.comIs it possible to know the target DOMWindow for HTTPRequest? - javascriptDownload TTF font from external path - iosLinking Opencv to my own Android project - androidMongoDB find a query with parameters loads the entire document into memory or not? - mongodbUbuntu GDM login screen X access - ubuntuITextSharp: text not wrapping an image inside a cell - c #Repeater inside repeater - c #Output management does not work - xpagesdo {} while (0) vs. if (1) {} in macros - cAll Articles