c# - Find the Last Match in a Regular Expression -
i have string , regular expression running against it. instead of first match, interested in last match of regular expression.
is there quick/easy way this?
i using regex.matches, returns matchcollection, doesn't accept parameters me, have go through collection , grab last one. seems there should easier way this. there?
the .net regex flavor allows search matches right left instead of left right. it's flavor know of offers such feature. it's cleaner , more efficient traditional methods, such prefixing regex .*
, or searching out matches can take last one.
to use it, pass option when call match()
(or other regex method):
regexoptions.righttoleft
more information can found here.
Comments
Post a Comment