简体   繁体   中英

Lua Remove all Characters up to and Including 2nd ":" In start of String

I need to remove all characters up to and including the second colon.

ABC: Test B:Keep All: This 

results:

Keep All: This 

Assuming str is your string, you can simply match the relevant part: str:match"^.-:.-:(.+)"

Explanation: ^ forces the pattern to start right at the beginning of the string. Then it ignores as few characters as possible until it reaches the first semicolon, same for the next. After that, everything is in the capture group, and all remaining characters will be captured.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM