regex - Get the last instance of a pattern -
i need help in regular look last instance of pattern in single line.
the lines in question written in next pattern (separated slashes):
class="lang-none prettyprint-override">/this/is/how/it/looks/ in illustration above, expecting looks output.
note lines not uniform , can contain less or more strings example.
class="lang-none prettyprint-override">/it/can/be/shorter/ /it/can/also/be/longer/than/most/lines/ for above lines, expect shorter , lines respectively.
/([^/]*)/$
is regex need.
explanation:
class="lang-none prettyprint-override">/ # match slash ( # start capturing grouping number 1 [^/]* # match number of characters except slashes ) # end capturing grouping number 1 / # match slash $ # match position @ end of string test live on regex101.com.
regex powershell
No comments:
Post a Comment