Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I was messing around with patterns and trying to parse a string for some information.
- local str = "<water:100> askdjkl< << <<wood:2> <string:3"
- how would I extract only '<water:100>', '<wood:2>', and '<string:3' from this string?
- currently:
- for item in str:gmatch("<.->") do
- print(item)
- end
- The problem is that I can't get the last item because the '>' is supposed to be optional at the end of the string only. I've tried messing around with anchors and failed. Another thing I noticed is that for "wood" I get "< << <<wood:2>" even though I used .- to match the shortest sequence possible.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement