google / textfsm

Python module for parsing semi-structured text into python tables.
Apache License 2.0
1.09k stars 168 forks source link

How to match string from end #53

Closed ajayreddy28390 closed 5 years ago

ajayreddy28390 commented 5 years ago

How to match a string from end:

String: Github is good

Want to match good from right to left

Value string ((\S+)$)

Start
    ${string} -> Record

Expected Answer: good

Result: [ ]

buxtronix commented 5 years ago

This does it, it uses non-greedy matching:

Value string (\S+)

Start
    ^.*?${string}$$ -> Record