Regex match multiple elements -
I have regex that I'm trying to match specific function parameters
here I Trying to match the text:
addFill (path: svgjs.Element, Pattern: pattern, docMaxSide: number) {pathFillId (path)} In this example, I want to match the criteria with the words "path" "pattern" and "doctormax side". I want to make sure that it does not match the word "path" in the second line (where I'm calling PathfillID).
Here's my current regedx: \ (. *? (\ W +) :. *? \) Broken Down:
\ ( find the open feet (\ w +): one before a colon Occupation of the word . *? There may be more stuff after the colon \) Do parens Right now, it will only match the first item, the "path" but I need to match all the words mentioned above.
Update: I should have been more specific, it should only match if this is the function parameter. For example, I do not want path1 to match: var path1: string . The difficulty is coming with the regex, which only gets between the feet.
Try this: g modifier (global modifier to all Elements and do not come back at all) \ w + (? =) match)
See also
UPDATE If you want to match parameters only in parentheses, then do so Can:
\ w + (? =: [\ W.] + \ S * [,]])
< Strong>
Comments
Post a Comment